Heap fragmentation often comes from allocating objects with different lifetimes at the same time on the same pages. Parsing is a common case of this because you allocate the whole object tree then only keep some of it.
Not in the context of an HTTP server. As we just parse, use it in the request, and then return (freeing all the memory). I think the problem is because we have multiple requests being handled in tandem and Rust doesn't know it's probably better off allocating all of the data together and then freeing this big block.
That's what's nice about jemalloc, it has a more generic algorithm for reusing allocated blocks.
That's what's nice about jemalloc, it has a more generic algorithm for reusing allocated blocks.