Hi,
I implemented my own memory management if form of own allocator functions which operate on my own data structures and on my own, pre-allocated memory buffer.
This is my memory pool:
Does ret_val need to be aligned to machine word boundaries (which should be size(int))?Code:std::vector<unsigned char> pool(some_upper_size); void* my_alloc(size_t size) { reserve size un-allocated bytes inside pool on offset X; void* ret_val = &pool[0] + X; return ret_val; }
If I allocate a bunch of single unsigned chars using new, VC++ returns pointers every 32bit in release (every 64 bit in debug, but I guess it encodes error detection code into the heap space).
Thank you in advance!



LinkBack URL
About LinkBacks



CornedBee