Re: Memory leaks / Help with memprof & ps output



On Mon, Apr 08, 2002 at 11:14:43PM -0400, Valdis Kletnieks vt edu wrote:
> On Tue, 09 Apr 2002 04:58:23 +0200, Enrico Weigelt <weigelt metux de>  said:
> 
> > since we're again at the point talking about memleaks,
> > whats about using an garbage collector in glib ?
> 
> And you'd get a garbage collector to work in C *how*?

try the hans-boehm-collector ...
 
> Remember - you can't collect garbage if it still has a reference to
> it - and in C you can take an address and stash it in a pointer
> variable.  How does glib know if I've still got a pointer to something
> or not?
simply not produce dirty code ?

> int *b, **c;   /* global variable */
> 
> int foo()
> {
>     int *a;
>     a = malloc(100*(sizeof int));
>     b = a;
>     c = malloc(sizeof (int *));
>     *c = b;
>     /* Garbage collect *that* ;)     */
> }

if i've understood the hb-collecter right, it assumes an chunk as an
array of pointers if no other type information is available.

btw: whats about an reference counting heap allocator ?
this would also solve many problems.

~-n
--
 Enrico Weigelt    ==   meTUX IT services 
 software development, IT service, internet security solutions
 www:     http://www.metux.de/        phone:     +49 36207 519931
 email:   contact metux de            cellphone: +49 174 7066481



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]