Debugging Memory Problems with MemoryScape™
:
Chapter 1 Locating Memory Problems
:
Event and Error Notification
:
Types of Problems
:
Freeing Stack Memory
Freeing Stack Memory
The following program allocates stack memory for the
stack_addr
variable. Because the memory was allocated on the stack, the program cannot deallocate it.
int main (int argc, char *argv[])
{
void *stack_addr = &stack_addr;
/* Error: freeing a stack address */
free(stack_addr);
return 0;
}