Re: writing to freed memory--issues
- From: ellis@xxxxxxx ()
- Date: Wed, 29 Mar 2006 00:14:13 -0000
In article <1143486280.691193.21870@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
bill pursell <bill.pursell@xxxxxxxxx> wrote:
I was playing around with a toy program, which led to some confusion.
I had expected that doing the following would lead to an immediate
segfault:
free(a);
*a=0;
You are returning the memory to the C run time library. That doesn't
mean your process loses access. The free() function usually just
returns the memory to a pool to be used in later calls to malloc().
See this for more info:
http://lists.linuxcoding.com/libc/Freeing-after-Malloc.html
--
http://www.spinics.net/lists/linux-c-programming/
http://www.spinics.net/lists/linux-newbi/
.
- References:
- writing to freed memory--issues
- From: bill pursell
- writing to freed memory--issues
- Prev by Date: Re: what's the relation among wxWidgets,xWindows and GTK+?
- Next by Date: Re: what's the relation among wxWidgets,xWindows and GTK+?
- Previous by thread: Re: writing to freed memory--issues
- Next by thread: Shared libraries : better management strategies ?
- Index(es):
Relevant Pages
|