summaryrefslogtreecommitdiffstats
path: root/src/quarantine.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.