Fulcrum/config.tests/jemalloc/main.cpp
Axel Gembe dd5dc4a242
Build: Add test for jemalloc and link it if found
Jemalloc is better suited for the memory usage pattern of Fulcrum,
which is allocating/freeing lots of random sized buffers from multiple
threads, resulting in lots of fragmentation.

Jemalloc is a general purpose malloc(3) implementation that emphasizes
fragmentation avoidance and scalable concurrency support.
2020-08-26 18:01:59 +07:00

13 lines
193 B
C++

#include <cstdlib>
#include <jemalloc/jemalloc.h>
int main()
{
if (malloc(1) == nullptr)
return 1;
if (mallocx(1, MALLOCX_ZERO) == nullptr)
return 1;
return 0;
}