Do pointers returned by malloc/new have to be aligned?
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))?
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 + X;
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!