Re: why no palloc() ("permanent alloc")?
- From: Paul Pluzhnikov <ppluzhnikov-nsp@xxxxxxxxx>
- Date: Sat, 19 Jul 2008 19:33:39 -0700
Barry Margolin <barmar@xxxxxxxxxxxx> writes:
The warnings aren't about unreachable pointers, they're for pointers
that are never freed. They're needed until the end of the program, so
he's happy with letting the system free them when the process exits.
But valgrind doesn't know this.
Actually, valgrind knows this perfectly well, and wouldn't be quite
as useful as it is if it didn't:
#include <stdlib.h>
void *reachable;
int main()
{
void *leaked = malloc(10);
reachable = malloc(20);
return 0;
}
$ gcc -g t.c && valgrind ./a.out
==13228== LEAK SUMMARY:
*> ==13228== definitely lost: 10 bytes in 1 blocks.
==13228== possibly lost: 0 bytes in 0 blocks.
*> ==13228== still reachable: 20 bytes in 1 blocks.
==13228== suppressed: 0 bytes in 0 blocks.
==13228== Use --leak-check=full to see details of leaked memory.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
.
- Follow-Ups:
- Re: why no palloc() ("permanent alloc")?
- From: Bernie Ohls
- Re: why no palloc() ("permanent alloc")?
- From: phil-news-nospam
- Re: why no palloc() ("permanent alloc")?
- References:
- why no palloc() ("permanent alloc")?
- From: Bernie Ohls
- Re: why no palloc() ("permanent alloc")?
- From: Joachim Schmitz
- Re: why no palloc() ("permanent alloc")?
- From: phil-news-nospam
- Re: why no palloc() ("permanent alloc")?
- From: Joachim Schmitz
- Re: why no palloc() ("permanent alloc")?
- From: Joachim Schmitz
- Re: why no palloc() ("permanent alloc")?
- From: Barry Margolin
- why no palloc() ("permanent alloc")?
- Prev by Date: Re: why no palloc() ("permanent alloc")?
- Next by Date: Re: why no palloc() ("permanent alloc")?
- Previous by thread: Re: why no palloc() ("permanent alloc")?
- Next by thread: Re: why no palloc() ("permanent alloc")?
- Index(es):
Relevant Pages
|