mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2024-10-01 01:36:01 -04:00
ignore pad argument to malloc_trim per glibc
The pad argument is only used by the main arena for sbrk in glibc, with every other page size gap purged with MADV_DONTNEED. It makes more sense to simply treat it as an ignored legacy parameter rather than trying to come up with a sensible way to use it for keeping cached free slabs.
This commit is contained in:
parent
af393afc09
commit
3f80895822
8
malloc.c
8
malloc.c
@ -981,13 +981,7 @@ EXPORT int h_mallopt(UNUSED int param, UNUSED int value) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const size_t pad_threshold = max_empty_slabs_total * N_SIZE_CLASSES;
|
||||
|
||||
EXPORT int h_malloc_trim(size_t pad) {
|
||||
if (pad > pad_threshold) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT int h_malloc_trim(UNUSED size_t pad) {
|
||||
if (!is_init()) {
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user