summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Add missing header includes in jemalloc/jemalloc.h .Jason Evans2014-10-052-2/+4
| | | | | | | Add stdlib.h, stdbool.h, and stdint.h to jemalloc/jemalloc.h so that applications only have to #include <jemalloc/jemalloc.h>. This resolves #132.
* Fix prof regressions.Jason Evans2014-10-041-16/+23
| | | | | | | | | | | Fix prof regressions related to tdata (main per thread profiling data structure) destruction: - Deadlock. The fix for this was intended to be part of 20c31deaae38ed9aa4fe169ed65e0c45cd542955 (Test prof.reset mallctl and fix numerous discovered bugs.) but the fix was left incomplete. - Destruction race. Detaching tdata just prior to destruction without holding the tdatas lock made it possible for another thread to destroy the tdata out from under the thread that was on its way to doing so.
* Don't disable tcache for lazy-lock.Jason Evans2014-10-041-2/+0
| | | | | | Don't disable tcache when lazy-lock is configured. There already exists a mechanism to disable tcache, but doing so automatically due to lazy-lock causes surprising performance behavior.
* Avoid purging in microbench when lazy-lock is enabled.Jason Evans2014-10-041-0/+9
|
* Silence a compiler warning.Jason Evans2014-10-041-1/+1
|
* Make prof-related inline functions always-inline.Jason Evans2014-10-041-9/+9
|
* Don't force TLS on behalf of heap profiling.Jason Evans2014-10-041-5/+0
| | | | | | | | Revert 6716aa83526b3f866d73a033970cc920bc61c13f (Force use of TLS if heap profiling is enabled.). No existing tests indicate that this is necessary, nor does code inspection uncover any potential issues. Most likely the original commit covered up a bug related to tsd-internal allocation that has since been fixed.
* Fix tsd cleanup regressions.Jason Evans2014-10-0412-147/+137
| | | | | | | | | | | | | | | | Fix tsd cleanup regressions that were introduced in 5460aa6f6676c7f253bfcb75c028dfd38cae8aaf (Convert all tsd variables to reside in a single tsd structure.). These regressions were twofold: 1) tsd_tryget() should never (and need never) return NULL. Rename it to tsd_fetch() and simplify all callers. 2) tsd_*_set() must only be called when tsd is in the nominal state, because cleanup happens during the nominal-->purgatory transition, and re-initialization must not happen while in the purgatory state. Add tsd_nominal() and use it as needed. Note that tsd_*{p,}_get() can still be used as long as no re-initialization that would require cleanup occurs. This means that e.g. the thread_allocated counter can be updated unconditionally.
* Fix install_lib target (incorrect jemalloc.pc path).Jason Evans2014-10-041-1/+1
|
* Skip test_prof_thread_name_validation if !config_prof.Jason Evans2014-10-041-0/+2
|
* Implement/test/fix prof-related mallctl's.Jason Evans2014-10-0411-65/+544
| | | | | | | | | | | Implement/test/fix the opt.prof_thread_active_init, prof.thread_active_init, and thread.prof.active mallctl's. Test/fix the thread.prof.name mallctl. Refactor opt_prof_active to be read-only and move mutable state into the prof_active variable. Stop leaning on ctl-related locking for protection.
* Convert to uniform style: cond == false --> !condJason Evans2014-10-0320-115/+111
|
* Remove obsolete comment.Jason Evans2014-10-031-6/+0
|
* Test prof.reset mallctl and fix numerous discovered bugs.Jason Evans2014-10-035-76/+405
|
* Refactor permuted backtrace test allocation.Jason Evans2014-10-0210-56/+60
| | | | | | Refactor permuted backtrace test allocation that was originally used only by the prof_accum test, so that it can be used by other heap profiling test binaries.
* Implement in-place huge allocation shrinking.Daniel Micay2014-10-011-27/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | Trivial example: #include <stdlib.h> int main(void) { void *ptr = malloc(1024 * 1024 * 8); if (!ptr) return 1; ptr = realloc(ptr, 1024 * 1024 * 4); if (!ptr) return 1; } Before: mmap(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcfff000000 mmap(NULL, 4194304, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcffec00000 madvise(0x7fcfff000000, 8388608, MADV_DONTNEED) = 0 After: mmap(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1934800000 madvise(0x7f1934c00000, 4194304, MADV_DONTNEED) = 0 Closes #134
* correctly detect adaptive mutexes in pthreadsEric Wong2014-09-293-1/+16
| | | | | PTHREAD_MUTEX_ADAPTIVE_NP is an enum on glibc and not a macro, we must test for their existence by attempting compilation.
* Merge pull request #128 from daverigby/cygwinJason Evans2014-09-291-1/+1
|\ | | | | autoconf: Support cygwin in addition to mingw
| * autoconf: Support cygwin in addition to mingwDave Rigby2014-09-241-1/+1
| |
* | Merge pull request #129 from daverigby/msvc_lg_floorJason Evans2014-09-291-0/+15
|\ \ | | | | | | Use MSVC intrinsics for lg_floor
| * | Use MSVC intrinsics for lg_floorDave Rigby2014-09-241-0/+15
| |/ | | | | | | | | When using MSVC make use of its intrinsic functions (supported on x86, amd64 & ARM) for lg_floor.
* | Mark malloc_conf as a weak symbolDave Rigby2014-09-291-1/+1
| | | | | | | | This fixes issue #113 - je_malloc_conf is not respected on OS X
* | Move small run metadata into the arena chunk header.Jason Evans2014-09-293-261/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move small run metadata into the arena chunk header, with multiple expected benefits: - Lower run fragmentation due to reduced run sizes; runs are more likely to completely drain when there are fewer total regions. - Improved cache behavior. Prior to this change, run headers were always page-aligned, which put extra pressure on some CPU cache sets. The degree to which this was a problem was hardware dependent, but it likely hurt some even for the most advanced modern hardware. - Buffer overruns/underruns are less likely to corrupt allocator metadata. - Size classes between 4 KiB and 16 KiB become reasonable to support without any special handling, and the runs are small enough that dirty unused pages aren't a significant concern.
* | Implement compile-time bitmap size computation.Jason Evans2014-09-283-26/+54
| |
* | Fix profile dumping race.Jason Evans2014-09-252-1/+10
|/ | | | | | | | | | | | | | Fix a race that caused a non-critical assertion failure. To trigger the race, a thread had to be part way through initializing a new sample, such that it was discoverable by the dumping thread, but not yet linked into its gctx by the time a later dump phase would normally have reset its state to 'nominal'. Additionally, lock access to the state field during modification to transition to the dumping state. It's not apparent that this oversight could have caused an actual problem due to outer locking that protects the dumping machinery, but the added locking pedantically follows the stated locking protocol for the state field.
* Add instructions for installing from non-packaged sources.Jason Evans2014-09-231-2/+15
|
* Convert all tsd variables to reside in a single tsd structure.Jason Evans2014-09-2322-935/+1027
|
* Ignore jemalloc.pc .Jason Evans2014-09-221-0/+2
|
* Generate a pkg-config fileNick White2014-09-193-1/+23
|
* fix tls_model autoconf testDaniel Micay2014-09-161-1/+1
| | | | | | It has an unused variable, so it was always failing (at least with gcc 4.9.1). Alternatively, the `-Werror` flag could be removed if it isn't strictly necessary.
* Fixed iOS build after OR1 changesValerii Hiora2014-09-121-0/+3
|
* Fix prof regressions.Jason Evans2014-09-121-1/+22
| | | | | | | | | | | | Don't use atomic_add_uint64(), because it isn't available on 32-bit platforms. Fix forking support functions to manage all prof-related mutexes. These regressions were introduced by 602c8e0971160e4b85b08b16cf8a2375aa24bc04 (Implement per thread heap profiling.), which did not make it into any releases prior to these fixes.
* Fix irallocx_prof() sample logic.Jason Evans2014-09-121-3/+3
| | | | | | | | Fix irallocx_prof() sample logic to only update the threshold counter after it knows what size the allocation ended up being. This regression was caused by 6e73dc194ee9682d3eacaf725a989f04629718f7 (Fix a profile sampling race.), which did not make it into any releases prior to this fix.
* Apply likely()/unlikely() to allocation/deallocation fast paths.Jason Evans2014-09-128-129/+138
|
* Fix mallocx() to always honor MALLOCX_ARENA() when profiling.Jason Evans2014-09-111-2/+1
|
* mark some conditions as unlikelyDaniel Micay2014-09-114-31/+31
| | | | | | | | | | | | * assertion failure * malloc_init failure * malloc not already initialized (in malloc_init) * running in valgrind * thread cache disabled at runtime Clang and GCC already consider a comparison with NULL or -1 to be cold, so many branches (out-of-memory) are already correctly considered as cold and marking them is not important.
* add likely / unlikely macrosDaniel Micay2014-09-101-0/+8
|
* Add sdallocx() to list of functions to prune in pprof.Jason Evans2014-09-101-0/+1
|
* Fix a profile sampling race.Jason Evans2014-09-104-73/+109
| | | | | | | | | | | Fix a profile sampling race that was due to preparing to sample, yet doing nothing to assure that the context remains valid until the stats are updated. These regressions were caused by 602c8e0971160e4b85b08b16cf8a2375aa24bc04 (Implement per thread heap profiling.), which did not make it into any releases prior to these fixes.
* Fix prof_tdata_get()-related regressions.Jason Evans2014-09-092-30/+26
| | | | | | | | | | | | | Fix prof_tdata_get() to avoid dereferencing an invalid tdata pointer (when it's PROF_TDATA_STATE_{REINCARNATED,PURGATORY}). Fix prof_tdata_get() callers to check for invalid results besides NULL (PROF_TDATA_STATE_{REINCARNATED,PURGATORY}). These regressions were caused by 602c8e0971160e4b85b08b16cf8a2375aa24bc04 (Implement per thread heap profiling.), which did not make it into any releases prior to these fixes.
* Fix threaded heap profile bug in pprof.Jason Evans2014-09-091-1/+1
| | | | | Fix ReadThreadedHeapProfile to pass the correct parameters to AdjustSamples.
* Fix sdallocx() assertion.Jason Evans2014-09-091-16/+18
| | | | | Refactor sdallocx() and nallocx() to share inallocx(), and fix an sdallocx() assertion to check usize rather than size.
* Support threaded heap profiles in pprofBert Maher2014-09-091-126/+251
| | | | | | | | | - Add a --thread N option to select profile for thread N (otherwise, all threads will be printed) - The $profile map now has a {threads} element that is a map from thread id to a profile that has the same format as the {profile} element - Refactor ReadHeapProfile into smaller components and use them to implement ReadThreadedHeapProfile
* Merge pull request #115 from thestinger/isqalloctJason Evans2014-09-091-1/+1
|\ | | | | fix isqalloct (should call isdalloct)
| * fix isqalloct (should call isdalloct)Daniel Micay2014-09-091-1/+1
|/
* Add support for sized deallocation.Daniel Micay2014-09-0910-5/+201
| | | | | | | | | | | | | | | | | This adds a new `sdallocx` function to the external API, allowing the size to be passed by the caller. It avoids some extra reads in the thread cache fast path. In the case where stats are enabled, this avoids the work of calculating the size from the pointer. An assertion validates the size that's passed in, so enabling debugging will allow users of the API to debug cases where an incorrect size is passed in. The performance win for a contrived microbenchmark doing an allocation and immediately freeing it is ~10%. It may have a different impact on a real workload. Closes #28
* Add relevant function attributes to [msn]allocx().Jason Evans2014-09-082-20/+15
|
* Thwart optimization of free(malloc(1)) in microbench.Jason Evans2014-09-081-19/+25
|
* Merge pull request #114 from thestinger/timerJason Evans2014-09-083-11/+11
|\ | | | | avoid conflict with the POSIX timer_t type
| * avoid conflict with the POSIX timer_t typeDaniel Micay2014-09-083-11/+11
|/ | | | It hits a compilation error with glibc 2.19 without a rename.