|
|
|
|
|
by menaerus
1359 days ago
|
|
> Despite freeing more buffers than we allocate Technically, I hope you understand that this isn't possible but maybe I am misinterpreting what you're trying to say. auto buff = malloc(N);
free(buff);
free(buff);
is one way to free "more" buffers than allocated but this will lead to an UB and depending on the underlying system allocator implementation it may or may not crash.However, given how silly this would be I believe this is not what you're trying to convey? |
|
So, I assume, the context is, DuckDB allocates x buffers, frees x - m buffers at some point later, then allocates n buffers where n <<<< m, and yet malloc fails.
In the GitHub thread mytherin linked to above, Alexey Milovidov, ClickHouse CTO, points out that ClickHouse uses jemalloc and makes for a better choice than glibc malloc given the issue with fragmentation. It is likely that DuckDB switches to jemalloc, too.