Debugging Memory Problems with MemoryScape
:
Chapter 1 Locating Memory Problems
:
Event and Error Notification
:
Types of Problems
:
Freeing Data Section Memory
Freeing Data Section Memory
If your program initializes static and global variables, it places them in your executable’s data section. Your program cannot free this memory.
The following program tries to free a variable in this section:
static int data_var = 9;
int main (int argc, char *argv[])
{
void *addr = (void *) (&data_var);
/* Error: adress in data section */
free(addr);
return 0;
}