Here's the source code: https://github.com/RealPipeline/Paw/tree/master/src/memory
Basically, in the alloc function I return the blocks header + blockMetaSize, which is the size of the block header plus any extra bytes added in for alignment
In the free function, I try to get the header's address again by taking blockMetaSize from the address passed, but the address is incorrect
Here's some debug output:
Basically, in the alloc function I return the blocks header + blockMetaSize, which is the size of the block header plus any extra bytes added in for alignment
In the free function, I try to get the header's address again by taking blockMetaSize from the address passed, but the address is incorrect
Here's some debug output:
Code:
in alloc()
0x7faf8ad70c20 (the address of the data to return), 64 (blockMetaSize), 0x7faf8ad70020 (header address)
In free()
0x7faf8ad70c20 (the address of the data to free (correct)), 64 (blockMetaSize), 0x7faf8ad70b20 (calculated header address (wrong by b00!)