summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * Refactor prof_dump() to reduce contention.Jason Evans2014-01-162-172/+278
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor prof_dump() to use a two pass algorithm, and prof_leave() prior to the second pass. This avoids write(2) system calls while holding critical prof resources. Fix prof_dump() to close the dump file descriptor for all relevant error paths. Minimize the size of prof-related static buffers when prof is disabled. This saves roughly 65 KiB of application memory for non-prof builds. Refactor prof_ctx_init() out of prof_lookup_global().
| * Fix warnings and a test failure exposed on CentOS 6.3.Jason Evans2014-01-152-4/+5
| |
| * Refactor prof_lookup() by extracting prof_lookup_global().Jason Evans2014-01-151-82/+79
| |
| * Refactor overly large/complex functions.Jason Evans2014-01-152-383/+462
| | | | | | | | | | | | | | Refactor overly large functions by breaking out helper functions. Refactor overly complex multi-purpose functions into separate more specific functions.
| * Extract profiling code from [re]allocation functions.Jason Evans2014-01-1210-496/+552
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extract profiling code from malloc(), imemalign(), calloc(), realloc(), mallocx(), rallocx(), and xallocx(). This slightly reduces the amount of code compiled into the fast paths, but the primary benefit is the combinatorial complexity reduction. Simplify iralloc[t]() by creating a separate ixalloc() that handles the no-move cases. Further simplify [mrxn]allocx() (and by implication [mrn]allocm()) to make request size overflows due to size class and/or alignment constraints trigger undefined behavior (detected by debug-only assertions). Report ENOMEM rather than EINVAL if an OOM occurs during heap profiling backtrace creation in imemalign(). This bug impacted posix_memalign() and aligned_alloc().
| * Add junk/zero filling unit tests, and fix discovered bugs.Jason Evans2014-01-089-31/+420
| | | | | | | | | | | | Fix growing large reallocation to junk fill new space. Fix huge deallocation to junk fill when munmap is disabled.
| * Add util unit tests, and fix discovered bugs.Jason Evans2014-01-075-30/+416
| | | | | | | | | | | | | | | | | | | | | | | | | | Add unit tests for pow2_ceil(), malloc_strtoumax(), and malloc_snprintf(). Fix numerous bugs in malloc_strotumax() error handling/reporting. These bugs could have caused application-visible issues for some seldom used (0X... and 0... prefixes) or malformed MALLOC_CONF or mallctl() argument strings, but otherwise they had no impact. Fix numerous bugs in malloc_snprintf(). These bugs were not exercised by existing malloc_*printf() calls, so they had no impact.
| * Convert assert() in test code to assert_*().Jason Evans2014-01-041-4/+12
| |
| * Add unit tests for qr, ql, and rb.Jason Evans2014-01-044-3/+789
| |
| * Convert rtree from (void *) to (uint8_t) storage.Jason Evans2014-01-035-55/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | Reduce rtree memory usage by storing booleans (1 byte each) rather than pointers. The rtree code is only used to record whether jemalloc manages a chunk of memory, so there's no need to store pointers in the rtree. Increase rtree node size to 64 KiB in order to reduce tree depth from 13 to 3 on 64-bit systems. The conversion to more compact leaf nodes was enough by itself to make the rtree depth 1 on 32-bit systems; due to the fact that root nodes are smaller than the specified node size if possible, the node size change has no impact on 32-bit systems (assuming default chunk size).
| * Add rtree unit tests.Jason Evans2014-01-036-10/+165
| |
| * Clean up code formatting.Jason Evans2014-01-021-4/+2
| |
| * Fix an uninitialized variable read in xallocx().Jason Evans2013-12-201-0/+3
| |
| * Add stats unit tests.Jason Evans2013-12-202-1/+352
| |
| * Fix a few mallctl() documentation errors.Jason Evans2013-12-202-138/+144
| | | | | | | | Normalize mallctl() order (code and documentation).
| * Add mallctl*() unit tests.Jason Evans2013-12-204-15/+435
| |
| * Remove ENOMEM from the documented set of *mallctl() errors.Jason Evans2013-12-181-6/+0
| | | | | | | | | | | | | | *mallctl() always returns EINVAL and does partial result copying when *oldlenp is to short to hold the requested value, rather than returning ENOMEM. Therefore remove ENOMEM from the documented set of possible errors.
| * Add missing prototypes.Jason Evans2013-12-171-2/+7
| |
| * Add quarantine unit tests.Jason Evans2013-12-177-15/+193
| | | | | | | | | | | | | | | | | | Verify that freed regions are quarantined, and that redzone corruption is detected. Introduce a testing idiom for intercepting/replacing internal functions. In this case the replaced function is ordinarily a static function, but the idiom should work similarly for library-private functions.
| * Fix a typo in a string constant.Jason Evans2013-12-171-1/+1
| |
| * Add hash (MurmurHash3) tests.Jason Evans2013-12-173-4/+170
| | | | | | | | Add hash tests that are based on SMHasher's VerificationTest() function.
| * Add ckh unit tests.Jason Evans2013-12-172-3/+210
| |
| * Add rallocx() test of both alignment and zeroing.Jason Evans2013-12-161-5/+17
| |
| * Finish arena_prof_ctx_set() optimization.Jason Evans2013-12-161-7/+7
| | | | | | | | Delay reading the mapbits until it's unavoidable.
| * Don't junk-fill reallocations unless usize changes.Jason Evans2013-12-163-16/+4
| | | | | | | | | | | | | | | | | | | | | | Don't junk fill reallocations for which the request size is less than the current usable size, but not enough smaller to cause a size class change. Unlike malloc()/calloc()/realloc(), *allocx() contractually treats the full usize as the allocation, so a caller can ask for zeroed memory via mallocx() and a series of rallocx() calls that all specify MALLOCX_ZERO, and be assured that all newly allocated bytes will be zeroed and made available to the application without danger of allocator mutation until the size class decreases enough to cause usize reduction.
| * Optimize arena_prof_ctx_set().Jason Evans2013-12-163-78/+99
| | | | | | | | | | | | Refactor such that arena_prof_ctx_set() receives usize as an argument, and use it to determine whether to handle ptr as a small region, rather than reading the chunk page map.
| * Add zero/align tests for rallocx().Jason Evans2013-12-152-1/+122
| |
| * Fix name mangling issues.Jason Evans2013-12-134-36/+37
| | | | | | | | | | | | | | | | | | Move je_* definitions from jemalloc_macros.h.in to jemalloc_defs.h.in, because only the latter is an autoconf header (#undef substitution occurs). Fix unit tests to use automatic mangling, so that e.g. mallocx is macro-substituted to becom jet_mallocx.
| * Implement the *allocx() API.Jason Evans2013-12-1319-270/+859
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement the *allocx() API, which is a successor to the *allocm() API. The *allocx() functions are slightly simpler to use because they have fewer parameters, they directly return the results of primary interest, and mallocx()/rallocx() avoid the strict aliasing pitfall that allocm()/rallocx() share with posix_memalign(). The following code violates strict aliasing rules: foo_t *foo; allocm((void **)&foo, NULL, 42, 0); whereas the following is safe: foo_t *foo; void *p; allocm(&p, NULL, 42, 0); foo = (foo_t *)p; mallocx() does not have this problem: foo_t *foo = (foo_t *)mallocx(42, 0);
| * Fix a strict aliasing violation.Jason Evans2013-12-121-2/+4
| |
| * Fix a malloc_mutex dependency in mtx.Jason Evans2013-12-121-1/+1
| |
| * Fix a strict aliasing violation.Jason Evans2013-12-121-2/+6
| |
| * Streamline test output.Jason Evans2013-12-122-13/+16
| |
| * Add mq (message queue) to test infrastructure.Jason Evans2013-12-1221-131/+441
| | | | | | | | | | | | | | | | | | Add mtx (mutex) to test infrastructure, in order to avoid bootstrapping complications that would result from directly using malloc_mutex. Rename test infrastructure's thread abstraction from je_thread to thd. Fix some header ordering issues.
| * Clean up SFMT test.Jason Evans2013-12-101-43/+40
| | | | | | | | | | | | | | | | Refactor array declarations to remove some dubious casts. Reduce array size to what is actually used. Extract magic numbers into cpp macro definitions.
| * Fix inline-related macro issues.Jason Evans2013-12-106-65/+43
| | | | | | | | | | | | | | | | | | Add JEMALLOC_INLINE_C and use it instead of JEMALLOC_INLINE in .c files, so that the annotated functions are always static. Remove SFMT's inline-related macros and use jemalloc's instead, so that there's no danger of interactions with jemalloc's definitions that disable inlining for debug builds.
| * Silence some unused variable warnings.Jason Evans2013-12-101-4/+4
| |
| * Add probabability distribution utility code.Jason Evans2013-12-1011-48/+731
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add probabability distribution utility code that enables generation of random deviates drawn from normal, Chi-square, and Gamma distributions. Fix format strings in several of the assert_* macros (remove a %s). Clean up header issues; it's critical that system headers are not included after internal definitions potentially do things like: #define inline Fix the build system to incorporate header dependencies for the test library C files.
| * Integrate SFMT 1.3.3 into test infrastructure.Jason Evans2013-12-0922-1/+3876
| | | | | | | | | | | | | | | | | | | | | | | | Integrate the SIMD-oriented Fast Mersenne Twister (SFMT) 1.3.3 into the test infrastructure. The sfmt_t state encapsulation modification comes from Crux (http://www.canonware.com/Crux/) and enables multiple concurrent PRNGs. test/unit/SFMT.c is an adaptation of SFMT's test.c that performs all the same validation, both for 32- and 64-bit generation.
| * Normalize #define whitespace.Jason Evans2013-12-0916-58/+58
| | | | | | | | Consistently use a tab rather than a space following #define.
| * Refactor tests.Jason Evans2013-12-0931-671/+843
| | | | | | | | | | | | | | Refactor tests to use explicit testing assertions, rather than diff'ing test output. This makes the test code a bit shorter, more explicitly encodes testing intent, and makes test failure diagnosis more straightforward.
| * Make jemalloc.h formatting more consistent.Jason Evans2013-12-074-63/+66
| |
| * Add test code coverage analysis.Jason Evans2013-12-077-10/+127
| | | | | | | | Add test code coverage analysis based on gcov.
| * Disable floating point code/linking when possible.Jason Evans2013-12-063-5/+28
| | | | | | | | | | | | | | | | | | | | | | Unless heap profiling is enabled, disable floating point code and don't link with libm. This, in combination with e.g. EXTRA_CFLAGS=-mno-sse on x64 systems, makes it possible to completely disable floating point register use. Some versions of glibc neglect to save/restore caller-saved floating point registers during dynamic lazy symbol loading, and the symbol loading code uses whatever malloc the application happens to have linked/loaded with, the result being potential floating point register corruption.
| * Fix more test refactoring issues.Jason Evans2013-12-068-109/+113
| |
| * Fix test refactoring issues for Linux.Jason Evans2013-12-064-35/+34
| |
| * Add tsd test.Jason Evans2013-12-054-4/+68
| | | | | | | | Submitted by Mike Hommey.
| * Fix build target to be build_lib, as documented.Jason Evans2013-12-041-2/+2
| | | | | | | | Reported by Michael Truog.
| * Refactor to support more varied testing.Jason Evans2013-12-0448-940/+1337
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the test harness to support three types of tests: - unit: White box unit tests. These tests have full access to all internal jemalloc library symbols. Though in actuality all symbols are prefixed by jet_, macro-based name mangling abstracts this away from test code. - integration: Black box integration tests. These tests link with the installable shared jemalloc library, and with the exception of some utility code and configure-generated macro definitions, they have no access to jemalloc internals. - stress: Black box stress tests. These tests link with the installable shared jemalloc library, as well as with an internal allocator with symbols prefixed by jet_ (same as for unit tests) that can be used to allocate data structures that are internal to the test code. Move existing tests into test/{unit,integration}/ as appropriate. Split out internal parts of jemalloc_defs.h.in and put them in jemalloc_internal_defs.h.in. This reduces internals exposure to applications that #include <jemalloc/jemalloc.h>. Refactor jemalloc.h header generation so that a single header file results, and the prototypes can be used to generate jet_ prototypes for tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in, jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and use a shell script to generate a unified jemalloc.h at configure time. Change the default private namespace prefix from "" to "je_". Add missing private namespace mangling. Remove hard-coded private_namespace.h. Instead generate it and private_unnamespace.h from private_symbols.txt. Use similar logic for public symbols, which aids in name mangling for jet_ symbols. Add test_warn() and test_fail(). Replace existing exit(1) calls with test_fail() calls.
| * Avoid deprecated sbrk(2) on OS X.Jason Evans2013-12-042-8/+15
| | | | | | | | | | Avoid referencing sbrk(2) on OS X, because it is deprecated as of OS X 10.9 (Mavericks), and the compiler warns against using it.