mirror of
https://github.com/FEX-Emu/jemalloc.git
synced 2024-11-23 06:59:39 +00:00
Merge pull request #3 from neobrain/feature_is_known_alloc
Add public helper to check if an allocation is managed by jemalloc
This commit is contained in:
commit
99e34d76bd
@ -269,6 +269,7 @@ JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_malloc_stats_print(
|
||||
const char *opts);
|
||||
JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_malloc_usable_size(
|
||||
JEMALLOC_USABLE_SIZE_CONST void *ptr) JEMALLOC_CXX_THROW;
|
||||
JEMALLOC_EXPORT int JEMALLOC_NOTHROW je_is_known_allocation(void* ptr) JEMALLOC_CXX_THROW;
|
||||
|
||||
#ifdef JEMALLOC_OVERRIDE_MEMALIGN
|
||||
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
|
||||
|
@ -3763,6 +3763,24 @@ je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_EXPORT int JEMALLOC_NOTHROW
|
||||
je_is_known_allocation(void* ptr) {
|
||||
int ret = 0;
|
||||
tsdn_t *tsdn = tsdn_fetch();
|
||||
|
||||
assert(malloc_initialized() || IS_INITIALIZER);
|
||||
|
||||
tsdn = tsdn_fetch();
|
||||
check_entry_exit_locking(tsdn);
|
||||
|
||||
if (likely(ptr != NULL)) {
|
||||
ret = ivsalloc(tsdn, ptr);
|
||||
}
|
||||
|
||||
check_entry_exit_locking(tsdn);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* End non-standard functions.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user