|
From: zhangyan <zha...@ba...> - 2008-12-14 12:56:05
|
Thank you for a lot,I think I figure out this problem quiet clearly.
Really appreciate your reply:-)
--------------------------------------------------------------------
On Sat, 13 Dec 2008, zhangyan wrote:
> #define N 79814486
> void foo()
> {
> char *a=(char*)malloc(N);
> }
> int main()
> {
> foo();
> return 0;
> }
>
> The memory allocated by (char*)malloc(N) is definitely lost,but why the
> valgrind give me the "possibly lost".And do you think is there any
possible
> value points into the middle of the allocated block ??? if it's,what is
the
> value which points to the allocated block possibly???
You need to understand what Valgrind means by "possibly" lost. Read the
manual:
http://www.valgrind.org/docs/manual/mc-manual.html#mc-manual.leaks
There could be random values in the address space that look like pointers
into a block, but which aren't really. The bigger a block is, the more
likely this is to happen.
Nick
|