Skip to content

Instantly share code, notes, and snippets.

@dongbum
Last active February 7, 2018 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dongbum/7d13a14c98763f862ce5d3803704ce3a to your computer and use it in GitHub Desktop.
Save dongbum/7d13a14c98763f862ce5d3803704ce3a to your computer and use it in GitHub Desktop.
new/delete override for jemalloc
#pragma once
class MemoryPool
{
public:
MemoryPool(void) {}
virtual ~MemoryPool(void) {}
void* operator new(size_t size)
{
return je_malloc(size);
}
void* operator new[](size_t size)
{
return je_malloc(size);
}
void operator delete(void* ptr)
{
je_free(ptr);
}
void operator delete[](void* ptr)
{
je_free(ptr);
}
private:
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment