3 ms·
Fast Memory Pool Allocators: Boost, Nginx and Tempesta FW
- rwmj 11y agoPools are great. They work really well with servers of all kinds. Even better are pool allocators that support subpools, and adding arbitrary objects that can be closed/deleted with the pool (like files). Eons ago I wrote a nice little C pool allocator: http://git.annexia.org/?p=c2lib.git;a=blob;f=pool.h;h=f8ed4c463d3ca29f55aef1aa6e484b0a1b21e12c;hb=HEAD http://git.annexia.org/?p=c2lib.git;a=blob;f=pool.h;h=f8ed4c...
- ck2 11y agoSomewhat related I tried to compile nginx with --with-ld-opt="-ljemalloc" to make it use jemalloc for more performance and it did not really like that, threw segfaults at random during runtime. Don't understand enough to know why.
- pquerna 11y agoAnother interesting implementation that is written by an apache http server, APR, and subversion developer is pocore: https://github.com/gstein/pocore/blob/master/src/memory.c https://github.com/gstein/pocore/blob/master/src/memory.c https://github.com/gstein/pocore/blob/wiki/MemoryManagement.md https://github.com/gstein/pocore/blob/wiki/MemoryManagement.... It's design is heavily influenced by real world experiences -- as this post even changed its benchmarks to reflect that in an HTTP server, a request uses maybe 100 small chunks per request, you can make different optimization choices.