Commit Graph

11 Commits

Author SHA1 Message Date
Jason Evans
a0bf242230 Fix bootstrapping crash.
If a custom small_size2bin table was required due to non-default size
class settings, memory allocation prior to initializing chunk parameters
would cause a crash due to division by 0.  The fix re-orders the various
*_boot() function calls.

Bootstrapping is simpler now than it was before the base allocator
started just using the chunk allocator directly.  This allows
arena_boot[01]() to be combined.

Add error detection for pthread_atfork() and atexit() function calls.
2010-01-29 14:30:41 -08:00
Jason Evans
4fb7f51337 Fix a chunk leak in chunk_alloc_mmap().
A missing 'else' in chunk_alloc_mmap() caused an extra chunk to be
allocated every time the optimistic alignment path was entered, since
the following block would always be executed immediately afterward.
This chunk leak caused no increase in physical memory usage, but virtual
memory could grow until resource exaustion caused allocation failures.
2010-01-27 18:27:09 -08:00
Jason Evans
3c2343518c Implement mallctl{nametomib,bymib}().
Replace chunk stats code that was missing locking; this fixes a race
condition that could corrupt chunk statistics.

Converting malloc_stats_print() to use mallctl*().

Add a missing semicolon in th DSS code.

Convert malloc_tcache_flush() to a mallctl.

Convert malloc_swap_enable() to a set of mallctl's.
2010-01-27 13:10:56 -08:00
Jason Evans
41631d0061 Modify chunk_alloc() to support optional zeroing.
Use optional zeroing in arena_chunk_alloc() to avoid needless zeroing of
chunks.  This is particularly important in the context of swapfile and
DSS allocation, since a long-lived application may commonly recycle
chunks.
2010-01-24 17:13:07 -08:00
Jason Evans
bc25a47ee0 Various minor cleanups.
Clean up whitespace.

Lock access of swap_avail when printing stats.

Use inttypes.h for portable printf() format specifiers, specifically for
uint64_t (PRIu64).

Change highchunks and curchunks stats from (unsigned long) to (size_t).
2010-01-24 16:41:01 -08:00
Jason Evans
4201af0542 Add the --enable-swap configure option.
Add malloc_swap_enable().

Add the O/o JEMALLOC_OPTIONS flags, which control memory overcommit.

Fix mapped memory stats reporting for arenas.
2010-01-24 02:53:40 -08:00
Jason Evans
ed1bf457fb Add the w4opaque argument to numerous functions.
Add the w4opaque argument malloc_message() and malloc_stats_print(), and
propagate the change through all the internal APIs as necessary.
2010-01-19 12:11:25 -08:00
Jason Evans
b34e8684ec Add merged arena stats printing.
Add the "m" and "a" opts flags for malloc_stats_print().
2010-01-17 17:35:19 -08:00
Jason Evans
00b5c93347 Add the write4 parameter to malloc_stats_print().
Add malloc_cprintf() and malloc_vcprintf().
2010-01-17 15:49:25 -08:00
Jason Evans
b0fd5016db Add the --with-install-suffix configure option.
Fix some bugs in the Makefile's install target.
2010-01-17 01:49:20 -08:00
Jason Evans
e476f8a161 Refactor jemalloc.c into multiple source files.
Fix a stats bug in large object curruns accounting.

Replace tcache_bin_fill() with arena_tcache_fill(), and fix a bug in an OOM
error path.

Fix API name mangling to coexist with __attribute__((malloc)).
2010-01-16 09:53:50 -08:00