You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lokinet/llarp/mem_jemalloc.cpp

20 lines
376 B
C++

7 years ago
#include <jemalloc/jemalloc.h>
7 years ago
#include <llarp/mem.h>
7 years ago
7 years ago
namespace llarp {
static void *jem_malloc(size_t sz, size_t align) {
return mallocx(sz, MALLOCX_ALIGN(align));
}
7 years ago
7 years ago
static void jem_free(void *ptr) {
7 years ago
if (ptr) free(ptr);
7 years ago
}
7 years ago
} // namespace llarp
7 years ago
extern "C" {
7 years ago
void llarp_mem_jemalloc() {
llarp_g_mem.alloc = llarp::jem_malloc;
llarp_g_mem.free = llarp::jem_free;
}
7 years ago
}