I’m writing memory manager for Windows in c++. I’ve created a class that allocates memory and passes it back to the client as void*. I’ve overriden new and delete operators to use my allocator.
__forceinline void * operator new(size_t n)
{
EnterCriticalSection(&CriticalSection);
void *ret = Heap.Alloc(n);
LeaveCriticalSection(&CriticalSection);
return ret;
}
There are several threads that turn to allocator process asking for some amount of memory. Is there any possibility to pass this allocated memory using memory map or something like that to be able to pass memory between processes? Is there any way to just pass void* to another process to use allocated memory there?
You can’t just pass the
void*since each process has its own address space and an address in one has no meaning in the other. Have a look at this question, it seems to fulfill your needings