Finding Heap Deallocation Problems
TotalView can let you know when your program encounters a problem in deallocating memory. Some of the problems it can identify are:
*free() not allocated: An application calls the free() function by using an address that is not in a block allocated in the heap.
*realloc() not allocated: An application calls the realloc() function by using an address that is not in a block allocated in the heap.
*Address not at start of block: A free() or realloc() function receives a heap address that is not at the start of a previously allocated block.
If a library routine uses the program’s memory manager (that is, it is using the heap API) and a problem occurs, TotalView still locates the problem. For example, the strdup() string library function calls the malloc() function to create memory for a duplicated string. Since the strdup() function is calling the malloc() function, TotalView can track this memory.
TotalView can stop execution just before your program misuses a heap API operation, which allows you to see what the problem is before it actually occurs. (See How TotalView Intercepts Memory Data.)