Hey everyone, I want to overload the operator new and delete and so far it all works.
I found a C++ Game Engine that, however, uses an different technique than mine..
I don't know what is different, the results are the same, I can't seem to understand what he did there.
It allocates requested_bytes + sizeof(size_t) and writes the value of requested_bytes at the start of new_buffer, then returns new_buffer + sizeof(size_t).
So, for example, if you allocate 1024 bytes, you will get this back in memory (assuming 32-bit machine and little endianness):
1 2 3
00 04 00 00 00 00 00 ...
{_________} ^ The pointer you get back points here.
`-> Invisible data.