Is there a c/c++ lib provide memory pool implementation has stdlib-like interfaces?

124 Views Asked by At

I have an idea to create a manually managed continuously block of memory by c/c++ codes, and provides something like:

typef struct managedVM
{
  void* pBuffer;
  int length;
}managedVM;

typedef struct managedVMPtr
{
  managedVM* pVM;
  int offset;
}managedVMPtr;

managedVM* mvm_create(int bufferSize);//create a mvm buffer
managedVMPtr mvm_alloc(int size);//like malloc
template<T> managedVMPtr mvm_new(){return mvm_alloc(sizeof(T);}//like new
void mvm_free(managedVMPtr mvmPtr);//like free

then I can totally control the memory usage of all data structures allocated in this memory block, and serialize/deserialize the whole memory states at anytime.

I have searched a while for whether some existed open source libs have already achieved these goals and get no result for the lack of my knowledge about c/c++ programing. So I'm looking for some good fortune here, thanks.

0

There are 0 best solutions below