mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Merge branch '3287-prevent-memory-bloat-caused-by-a-jemalloc-quirk-v9_18' into 'v9_18'
[v9_18] Prevent memory bloat caused by a jemalloc quirk See merge request isc-projects/bind9!6153
This commit is contained in:
commit
0f59e1e270
2 changed files with 14 additions and 0 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
5866. [bug] Work around a jemalloc quirk which could trigger an
|
||||
out-of-memory condition in named over time. [GL #3287]
|
||||
|
||||
5863. [bug] If there was a pending negative cache DS entry,
|
||||
validations depending upon it could fail. [GL #3279]
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ struct isc__trampoline {
|
|||
uintptr_t self;
|
||||
isc_threadfunc_t start;
|
||||
isc_threadarg_t arg;
|
||||
void *jemalloc_enforce_init;
|
||||
};
|
||||
|
||||
static isc_once_t isc__trampoline_initialize_once = ISC_ONCE_INIT;
|
||||
|
|
@ -159,6 +160,7 @@ isc__trampoline_detach(isc__trampoline_t *trampoline) {
|
|||
isc__trampoline_min = trampoline->tid;
|
||||
}
|
||||
|
||||
free(trampoline->jemalloc_enforce_init);
|
||||
free(trampoline);
|
||||
|
||||
UNLOCK(&isc__trampoline_lock);
|
||||
|
|
@ -174,6 +176,15 @@ isc__trampoline_attach(isc__trampoline_t *trampoline) {
|
|||
/* Initialize the trampoline */
|
||||
isc_tid_v = trampoline->tid;
|
||||
trampoline->self = isc_thread_self();
|
||||
|
||||
/*
|
||||
* Ensure every thread starts with a malloc() call to prevent memory
|
||||
* bloat caused by a jemalloc quirk. While this dummy allocation is
|
||||
* not used for anything, free() must not be immediately called for it
|
||||
* so that an optimizing compiler does not strip away such a pair of
|
||||
* malloc() + free() calls altogether, as it would foil the fix.
|
||||
*/
|
||||
trampoline->jemalloc_enforce_init = malloc(8);
|
||||
}
|
||||
|
||||
isc_threadresult_t
|
||||
|
|
|
|||
Loading…
Reference in a new issue