Robert McConnell
2013-04-25 03:28:01 UTC
Recent revisions in a large mature software system have revealed a
malloc/free related problem in my code.
In the test configuration the code allocates a list of six successive
essentially identical small data blocks. Each allocation is separated by
a lot of code. Under user control I can choose to free any of the
blocks. When I try to free the third block, and only the third block, I
get a "task exception ... access violation message". I'm assuming that
some type of buffer overrun or equivalent between the time I allocate
the memory and the time I try to free it is corrupting the allocation
data structures related to this block. I'm trying to track down the code
that is doing the corruption. To do so I'm trying to figure out if
there's anything I can monitor, preferably using the debugger, to
identify exactly when the corruption takes place in order to track down
the source.
Any suggestions would be greatly appreciated.
-rob
malloc/free related problem in my code.
In the test configuration the code allocates a list of six successive
essentially identical small data blocks. Each allocation is separated by
a lot of code. Under user control I can choose to free any of the
blocks. When I try to free the third block, and only the third block, I
get a "task exception ... access violation message". I'm assuming that
some type of buffer overrun or equivalent between the time I allocate
the memory and the time I try to free it is corrupting the allocation
data structures related to this block. I'm trying to track down the code
that is doing the corruption. To do so I'm trying to figure out if
there's anything I can monitor, preferably using the debugger, to
identify exactly when the corruption takes place in order to track down
the source.
Any suggestions would be greatly appreciated.
-rob