Browse Source

[core] retain largest chunk on oversized chunk lst

retain largest chunk on oversized chunk list if list size limit reached
master
Glenn Strauss 2 months ago
parent
commit
8d63c7900d
  1. 9
      src/chunk.c

9
src/chunk.c

@ -144,8 +144,15 @@ static void chunk_push_oversized(chunk * const c, const size_t sz) {
c->next = *co;
*co = c;
}
else
else {
buffer * const tb = chunks_oversized ? chunks_oversized->mem : NULL;
if (tb && tb->size < sz) {
/* swap larger mem block onto head of list; free smaller mem */
chunks_oversized->mem = c->mem;
c->mem = tb;
}
chunk_free(c);
}
}
__attribute_returns_nonnull__

Loading…
Cancel
Save