mirror of https://github.com/oxen-io/lokinet
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.
24 lines
383 B
C++
24 lines
383 B
C++
#include <llarp/mem.h>
|
|
#include <jemalloc/jemalloc.h>
|
|
|
|
namespace llarp
|
|
{
|
|
static void * jem_malloc(size_t sz, size_t align)
|
|
{
|
|
return mallocx(sz, MALLOCX_ALIGN(align));
|
|
}
|
|
|
|
static void jem_free(void * ptr)
|
|
{
|
|
if(ptr) free(ptr);
|
|
}
|
|
}
|
|
|
|
extern "C" {
|
|
void llarp_mem_jemalloc()
|
|
{
|
|
llarp_g_mem.alloc = llarp::jem_malloc;
|
|
llarp_g_mem.free = llarp::jem_free;
|
|
}
|
|
}
|