mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-22 16:47:21 +03:00
Try to decommit new chunks.
Always leave decommit disabled on non-Windows systems.
This commit is contained in:
parent
1f27abc1b1
commit
03bf5b67be
4 changed files with 27 additions and 15 deletions
|
|
@ -145,7 +145,8 @@ chunk_alloc_dss(arena_t *arena, void *new_addr, size_t size, size_t alignment,
|
|||
ret, size);
|
||||
memset(ret, 0, size);
|
||||
}
|
||||
*commit = true;
|
||||
if (!*commit)
|
||||
*commit = pages_decommit(ret, size);
|
||||
return (ret);
|
||||
}
|
||||
} while (dss_prev != (void *)-1);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ chunk_alloc_mmap_slow(size_t size, size_t alignment, bool *zero, bool *commit)
|
|||
|
||||
assert(ret != NULL);
|
||||
*zero = true;
|
||||
*commit = true;
|
||||
if (!*commit)
|
||||
*commit = pages_decommit(ret, size);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +62,8 @@ chunk_alloc_mmap(size_t size, size_t alignment, bool *zero, bool *commit)
|
|||
|
||||
assert(ret != NULL);
|
||||
*zero = true;
|
||||
*commit = true;
|
||||
if (!*commit)
|
||||
*commit = pages_decommit(ret, size);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,13 @@ pages_commit_impl(void *addr, size_t size, bool commit)
|
|||
{
|
||||
|
||||
#ifndef _WIN32
|
||||
if (config_debug) {
|
||||
/*
|
||||
* The following decommit/commit implementation is functional, but
|
||||
* always disabled because it doesn't add value beyong improved
|
||||
* debugging (at the cost of extra system calls) on systems that
|
||||
* overcommit.
|
||||
*/
|
||||
if (false) {
|
||||
int prot = commit ? (PROT_READ | PROT_WRITE) : PROT_NONE;
|
||||
void *result = mmap(addr, size, prot, MAP_PRIVATE | MAP_ANON |
|
||||
MAP_FIXED, -1, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue