Reputation: 357
I am running valgrind on my code and see two errors.
Address 0x93d1e2c is 12 bytes after a block of size 2,048 alloc'd
I ran through all discussion and everywhere they mention that "Address xyz is "0" bytes after a block of size <>, alloc'd". It seems this happens when someone allocates X bytes and typecast it to something that has size Y bytes and Y > X.
So what does it mean when it says "12 bytes after a block" and not "0 bytes after a block"? can someone please help?
Thanks, Neil
Upvotes: 3
Views: 9757
Reputation: 994
It means Valgrind detected one block of memory you alloc'd (through malloc()
or similar) within your program, and the program tried to access the memory address which is 12 bytes after that block.
In short, this is an array out of bounds error, with you trying to access data after the actual array data.
Following the below line, you should see a callstack that indicates broadly where within your program the invalid access happens:
Address 0x93d1e2c is 12 bytes after a block of size 2,048 alloc'd
// Details of the callstack should be here
/* Details of the allocation of 2048 bytes should also
be present (separately) in Valgrind's output */
Upvotes: 4