3 ms·
RocksDB is awesome, though don't use it with regular glibc malloc because it can cause extreme memory fragmentation. Use jemalloc, tcmalloc, or mimalloc: basica
by dikei 3y ago
RocksDB is awesome, though don't use it with regular glibc malloc because it can cause extreme memory fragmentation. Use jemalloc, tcmalloc, or mimalloc: basically any other advance malloc libraries that can effectively reuse memory.
- jeffbee 3y agoThis goes for pretty much every C++ program. I doubt there are any useful programs for which the GNU allocator is optimal.
- dikei 3y agoFor databases maybe. However, most programs do not need to allocate so much memory, so frequently that an allocator become an issue.
- citrin_ru 3y agoglobc malloc works reasonably well if threads are not used (nginx and postgres are examples of apps which don’t rely on threads), but if an app uses many threads on multi core CPU shortcomings of glibc malloc (or advantages of jemalloc) become more obvious, especially if you use some LTS Linux distro with an old glibc.