3 ms·
Advanced Linux Memory Allocation
- nathanappere 15y agoAlthough it does nos focus on memory profiling, the best serie of post I know on memory allocation is Gustavo Duartes one: http://duartes.org/gustavo/blog/post/anatomy-of-a-program-in-memory http://duartes.org/gustavo/blog/post/anatomy-of-a-program-in... http://duartes.org/gustavo/blog/post/how-the-kernel-manages-your-memory http://duartes.org/gustavo/blog/post/how-the-kernel-manages-... http://duartes.org/gustavo/blog/post/page-cache-the-affair-between-memory-and-files http://duartes.org/gustavo/blog/post/page-cache-the-affair-b...
- ajross 15y agoAnd any discussion about memory topics under linux has to include Ulrich Drepper's fantastic series of LWN.net articles: http://lwn.net/Articles/257209/ http://lwn.net/Articles/257209/ Very thick in places, but absolutely worth reading. Still the only good place to find an exposition about how SDRAM timings actually work.
- acg 15y agoAlso worth looking into tcmalloc: http://goog-perftools.sourceforge.net/doc/tcmalloc.html http://goog-perftools.sourceforge.net/doc/tcmalloc.html Which comes with tools: http://goog-perftools.sourceforge.net/doc/heap_checker.html http://goog-perftools.sourceforge.net/doc/heap_checker.html http://goog-perftools.sourceforge.net/doc/heap_profiler.html http://goog-perftools.sourceforge.net/doc/heap_profiler.html
- srean 15y agoAlso nedmalloc https://github.com/ned14/nedmalloc https://github.com/ned14/nedmalloc and hoard http://www.hoard.org/ http://www.hoard.org/. There is some comparison between the three here http://www.nedprod.com/programs/portable/nedmalloc/#FAQ http://www.nedprod.com/programs/portable/nedmalloc/#FAQ The following is a snippet from that FAQ Is tcmalloc better or worse than nedmalloc?... nedmalloc is about equal to tcmalloc for threadcache-only ops and substantially beats it for non-threadcache ops. nedmalloc is also written in C rather than C++ and v0.5 of tcmalloc only works on Unix systems and not win32. tcmalloc achieves its speed by never returning memory to the system - free space reclamation is one of the slowest parts of any allocator. Therefore tcmalloc should NOT be used outside long running server processes (and indeed its own docs say the same). However I am not sure if the criticism about not returning the memory is true anymore for the latest version tcmalloc.