summaryrefslogtreecommitdiffstats
path: root/src/prof.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor prof_lookup() by extracting prof_lookup_global().Jason Evans2014-01-151-82/+79
|
* Fix whitespace.Jason Evans2013-10-281-1/+1
|
* Fix a file descriptor leak in a prof_dump_maps() error path.Jason Evans2013-10-211-8/+19
| | | | Reported by Pat Lynch.
* Consistently use malloc_mutex_prefork().Jason Evans2013-10-211-3/+3
| | | | | Consistently use malloc_mutex_prefork() instead of malloc_mutex_lock() in all prefork functions.
* Prefer not_reached() over assert(false) where appropriate.Jason Evans2013-10-211-3/+3
|
* Fix potential TLS-related memory corruption.Jason Evans2013-01-311-13/+5
| | | | | | | | | | Avoid writing to uninitialized TLS as a side effect of deallocation. Initializing TLS during deallocation is unsafe because it is possible that a thread never did any allocation, and that TLS has already been deallocated by the threads library, resulting in write-after-free corruption. These fixes affect prof_tdata and quarantine; all other uses of TLS are already safe, whether intentionally (as for tcache) or unintentionally (as for arenas).
* Update hash from MurmurHash2 to MurmurHash3.Jason Evans2013-01-221-25/+3
| | | | | | Update hash from MurmurHash2 to MurmurHash3, primarily because the latter generates 128 bits in a single call for no extra cost, which simplifies integration with cuckoo hashing.
* Avoid arena_prof_accum()-related locking when possible.Jason Evans2012-11-131-4/+2
| | | | | | | Refactor arena_prof_accum() and its callers to avoid arena locking when prof_interval is 0 (as when profiling is disabled). Reported by Ben Maurer.
* Fix fork(2)-related deadlocks.Jason Evans2012-10-091-0/+42
| | | | | | | | | | | | | | | | | Add a library constructor for jemalloc that initializes the allocator. This fixes a race that could occur if threads were created by the main thread prior to any memory allocation, followed by fork(2), and then memory allocation in the child process. Fix the prefork/postfork functions to acquire/release the ctl, prof, and rtree mutexes. This fixes various fork() child process deadlocks, but one possible deadlock remains (intentionally) unaddressed: prof backtracing can acquire runtime library mutexes, so deadlock is still possible if heap profiling is enabled during fork(). This deadlock is known to be a real issue in at least the case of libgcc-based backtracing. Reported by tfengjun.
* Fix more prof_tdata resurrection corner cases.Jason Evans2012-04-291-2/+2
|
* Handle prof_tdata resurrection.Jason Evans2012-04-291-17/+37
| | | | | Handle prof_tdata resurrection during thread shutdown, similarly to how tcache and quarantine handle resurrection.
* Don't set prof_tdata during thread cleanup.Jason Evans2012-04-281-3/+0
| | | | | | Don't set prof_tdata during thread cleanup, because doing so will cause the cleanup function to be called again, the second time with a NULL argument.
* Fix heap profiling bugs.Jason Evans2012-04-221-76/+88
| | | | | | | | | | | Fix a potential deadlock that could occur during interval- and growth-triggered heap profile dumps. Fix an off-by-one heap profile statistics bug that could be observed in interval- and growth-triggered heap profiles. Fix heap profile dump filename sequence numbers (regression during conversion to malloc_snprintf()).
* Update prof defaults to match common usage.Jason Evans2012-04-171-2/+3
| | | | | | | | | Change the "opt.lg_prof_sample" default from 0 to 19 (1 B to 512 KiB). Change the "opt.prof_accum" default from true to false. Add the "opt.prof_final" mallctl, so that "opt.prof_prefix" need not be abused to disable final profile dumping.
* Rename labels.Jason Evans2012-04-101-7/+7
| | | | | | | Rename labels from FOO to label_foo in order to avoid system macro definitions, in particular OUT and ERROR on mingw. Reported by Mike Hommey.
* Clean up *PAGE* macros.Jason Evans2012-04-021-1/+1
| | | | | | | | | | | s/PAGE_SHIFT/LG_PAGE/g and s/PAGE_SIZE/PAGE/g. Remove remnants of the dynamic-page-shift code. Rename the "arenas.pagesize" mallctl to "arenas.page". Remove the "arenas.chunksize" mallctl, which is redundant with "opt.lg_chunk".
* Remove ephemeral mutexes.Jason Evans2012-03-241-20/+43
| | | | | | | | | | | Remove ephemeral mutexes from the prof machinery, and remove malloc_mutex_destroy(). This simplifies mutex management on systems that call malloc()/free() inside pthread_mutex_{create,destroy}(). Add atomic_*_u() for operation on unsigned values. Fix prof_printf() to call malloc_vsnprintf() rather than malloc_snprintf().
* Implement tsd.Jason Evans2012-03-231-23/+22
| | | | | | | | | | | | | Implement tsd, which is a TLS/TSD abstraction that uses one or both internally. Modify bootstrapping such that no tsd's are utilized until allocation is safe. Remove malloc_[v]tprintf(), and use malloc_snprintf() instead. Fix %p argument size handling in malloc_vsnprintf(). Fix a long-standing statistics-related bug in the "thread.arena" mallctl that could cause crashes due to linked list corruption.
* Invert NO_TLS to JEMALLOC_TLS.Jason Evans2012-03-191-1/+1
|
* s/PRIx64/PRIxPTR/ for uintptr_t printf() argument.Jason Evans2012-03-121-1/+1
|
* Implement malloc_vsnprintf().Jason Evans2012-03-081-149/+72
| | | | | | | | | | | | Implement malloc_vsnprintf() (a subset of vsnprintf(3)) as well as several other printing functions based on it, so that formatted printing can be relied upon without concern for inducing a dependency on floating point runtime support. Replace malloc_write() calls with malloc_*printf() where doing so simplifies the code. Add name mangling for library-private symbols in the data and BSS sections. Adjust CONF_HANDLE_*() macros in malloc_conf_init() to expose all opt_* variable use to cpp so that proper mangling occurs.
* Use UINT64_C() rather than LLU for 64-bit constants.Jason Evans2012-03-051-4/+5
|
* Rename prn to prng.Jason Evans2012-03-021-1/+1
| | | | | Rename prn to prng so that Windows doesn't choke when trying to create a file named prn.h.
* Remove the opt.lg_prof_bt_max option.Jason Evans2012-02-141-14/+8
| | | | | | | | Remove opt.lg_prof_bt_max, and hard code it to 7. The original intention of this option was to enable faster backtracing by limiting backtrace depth. However, this makes graphical pprof output very difficult to interpret. In practice, decreasing sampling frequency is a better mechanism for limiting profiling overhead.
* Remove the opt.lg_prof_tcmax option.Jason Evans2012-02-141-6/+2
| | | | | | | Remove the opt.lg_prof_tcmax option and hard-code a cache size of 1024. This setting is something that users just shouldn't have to worry about. If lock contention actually ends up being a problem, the simple solution available to the user is to reduce sampling frequency.
* Reduce cpp conditional logic complexity.Jason Evans2012-02-111-6/+69
| | | | | | | | | | | | | | | | | | | | | | Convert configuration-related cpp conditional logic to use static constant variables, e.g.: #ifdef JEMALLOC_DEBUG [...] #endif becomes: if (config_debug) { [...] } The advantage is clearer, more concise code. The main disadvantage is that data structures no longer have conditionally defined fields, so they pay the cost of all fields regardless of whether they are used. In practice, this is only a minor concern; config_stats will go away in an upcoming change, and config_prof is the only other major feature that depends on more than a few special-purpose fields.
* Fix a prof-related race condition.Jason Evans2011-08-311-6/+19
| | | | | | | | Fix prof_lookup() to artificially raise curobjs for all paths through the code that creates a new entry in the per thread bt2cnt hash table. This fixes a race condition that could corrupt memory if prof_accum were false, and a non-default lg_prof_tcmax were used and/or threads were destroyed.
* Clean up prof-related comments.Jason Evans2011-08-101-23/+16
| | | | | | | Clean up some prof-related comments to more accurately reflect how the code works. Simplify OOM handling code in a couple of prof-related error paths.
* Use prof_tdata_cleanup() argument.Jason Evans2011-08-091-24/+19
| | | | | Use the argument to prof_tdata_cleanup(), rather than calling PROF_TCACHE_GET(). This fixes a bug in the NO_TLS case.
* Use LLU suffix for all 64-bit constants.Jason Evans2011-05-221-1/+1
| | | | | | Add the LLU suffix for all 0x... 64-bit constants. Reported by Jakob Blomer.
* Move repo contents in jemalloc/ to top level.Jason Evans2011-04-011-0/+1243