Debugging Memory Problems with MemoryScape™
:
Chapter 1 Locating Memory Problems
:
Event and Error Notification
:
Types of Problems
:
Freeing Memory That Is Already Freed
Freeing Memory That Is Already Freed
The following program allocates some memory, and then releases it twice. On some operating systems, your program will raise a SEGV on the second free request.
int main ()
{
void *s;
/* Get some memory */
s = malloc(sizeof(int)*200);
/* Now release the memory */
free(s);
/* Error: Release it again */
free(s);
return 0;
}
This site works best with JavaScript enabled