summaryrefslogtreecommitdiffstats
path: root/src/quarantine.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove quarantine support.Jason Evans2016-05-131-178/+0
|
* Remove Valgrind support.Jason Evans2016-05-131-6/+1
|
* Resolve bootstrapping issues when embedded in FreeBSD libc.Jason Evans2016-05-111-23/+21
| | | | | | | | | | | | | b2c0d6322d2307458ae2b28545f8a5c9903d7ef5 (Add witness, a simple online locking validator.) caused a broad propagation of tsd throughout the internal API, but tsd_fetch() was designed to fail prior to tsd bootstrapping. Fix this by splitting tsd_t into non-nullable tsd_t and nullable tsdn_t, and modifying all internal APIs that do not critically rely on tsd to take nullable pointers. Furthermore, add the tsd_booted_get() function so that tsdn_fetch() can probe whether tsd bootstrapping is complete and return NULL if not. All dangerous conversions of nullable pointers are tsdn_tsd() calls that assert-fail on invalid conversion.
* Do not allocate metadata via non-auto arenas, nor tcaches.Jason Evans2016-04-221-4/+4
| | | | | This assures that all internally allocated metadata come from the first opt_narenas arenas, i.e. the automatically multiplexed arenas.
* Add witness, a simple online locking validator.Jason Evans2016-04-141-2/+2
| | | | This resolves #358.
* Add JEMALLOC_ALLOC_JUNK and JEMALLOC_FREE_JUNK macrosChris Peterson2016-03-311-1/+1
| | | | | Replace hardcoded 0xa5 and 0x5a junk values with JEMALLOC_ALLOC_JUNK and JEMALLOC_FREE_JUNK macros, respectively.
* Fast-path improvement: reduce # of branches and unnecessary operations.Qi Wang2015-11-101-9/+11
| | | | | | - Combine multiple runtime branches into a single malloc_slow check. - Avoid calling arena_choose / size2index / index2size on fast path. - A few micro optimizations.
* Bypass tcache when draining quarantined allocations.Jason Evans2015-05-301-3/+3
| | | | | | This avoids the potential surprise of deallocating an object with one tcache specified, and having the object cached in a different tcache once it drains from the quarantine.
* Implement explicit tcache support.Jason Evans2015-02-101-5/+5
| | | | | | | | | Add the MALLOCX_TCACHE() and MALLOCX_TCACHE_NONE macros, which can be used in conjunction with the *allocx() API. Add the tcache.create, tcache.flush, and tcache.destroy mallctls. This resolves #145.
* Implement metadata statistics.Jason Evans2015-01-241-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | There are three categories of metadata: - Base allocations are used for bootstrap-sensitive internal allocator data structures. - Arena chunk headers comprise pages which track the states of the non-metadata pages. - Internal allocations differ from application-originated allocations in that they are for internal use, and that they are omitted from heap profiles. The metadata statistics comprise the metadata categories as follows: - stats.metadata: All metadata -- base + arena chunk headers + internal allocations. - stats.arenas.<i>.metadata.mapped: Arena chunk headers. - stats.arenas.<i>.metadata.allocated: Internal allocations. This is reported separately from the other metadata statistics because it overlaps with the allocated and active statistics, whereas the other metadata statistics do not. Base allocations are not reported separately, though their magnitude can be computed by subtracting the arena-specific metadata. This resolves #163.
* Introduce two new modes of junk filling: "alloc" and "free".Guilherme Goncalves2014-12-151-1/+1
| | | | | | | | In addition to true/false, opt.junk can now be either "alloc" or "free", giving applications the possibility of junking memory only on allocation or deallocation. This resolves #172.
* Style and spelling fixes.Jason Evans2014-12-091-2/+2
|
* Make quarantine_init() static.Jason Evans2014-11-071-1/+1
|
* Fix two quarantine regressions.Jason Evans2014-11-051-0/+22
| | | | | | | | Fix quarantine to actually update tsd when expanding, and to avoid double initialization (leaking the first quarantine) due to recursive initialization. This resolves #161.
* Convert all tsd variables to reside in a single tsd structure.Jason Evans2014-09-231-69/+30
|
* Apply likely()/unlikely() to allocation/deallocation fast paths.Jason Evans2014-09-121-2/+2
|
* Remove the "opt.valgrind" mallctl.Jason Evans2014-04-151-1/+1
| | | | | Remove the "opt.valgrind" mallctl because it is unnecessary -- jemalloc automatically detects whether it is running inside valgrind.
* Add quarantine unit tests.Jason Evans2013-12-171-2/+11
| | | | | | | | | 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 two quarantine bugs.Jason Evans2013-01-311-10/+19
| | | | | | | Internal reallocation of the quarantined object array leaked the old array. Reallocation failure for internal reallocation of the quarantined object array (very unlikely) resulted in memory corruption.
* Fix potential TLS-related memory corruption.Jason Evans2013-01-311-42/+13
| | | | | | | | | | 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).
* Fix quarantine_grow() bugs.Jason Evans2012-04-241-9/+8
|
* Add usize sanity checking to quarantine.Jason Evans2012-04-241-13/+21
|
* Handle quarantine resurrection during thread exit.Jason Evans2012-04-241-5/+45
| | | | | Handle quarantine resurrection during thread exit in much the same way as tcache resurrection is handled.
* Clean up a few config-related conditionals/asserts.Jason Evans2012-04-181-2/+2
| | | | | | Clean up a few config-related conditionals to avoid unnecessary dependencies on prof symbols. Use cassert() rather than assert() everywhere that it's appropriate.
* Implement Valgrind support, redzones, and quarantine.Jason Evans2012-04-111-0/+163
Implement Valgrind support, as well as the redzone and quarantine features, which help Valgrind detect memory errors. Redzones are only implemented for small objects because the changes necessary to support redzones around large and huge objects are complicated by in-place reallocation, to the point that it isn't clear that the maintenance burden is worth the incremental improvement to Valgrind support. Merge arena_salloc() and arena_salloc_demote(). Refactor i[v]salloc() to expose the 'demote' option.