[Gc] Re: Fwd: GC_free crash when used with FreeImage library

Boehm, Hans hans.boehm at hp.com
Sun Aug 5 10:14:45 PDT 2012


I agree that this is entirely consistent with calling GC_free on a location that either wasn't allocated through GC_malloc or friends, or has already been deallocated.  The interesting question is where the argument address came from.  A call to GC_print_heap_sects() will let you determine whether it's in a heap section managed by the collector.  If it's in a GC managed section, the next step would be to look for prior GC_free calls on the same location.

Hans

> -----Original Message-----
> From: gc-bounces at linux.hpl.hp.com [mailto:gc-bounces at linux.hpl.hp.com]
> On Behalf Of Ivan Maidanski
> Sent: Sunday, August 05, 2012 1:28 AM
> To: Eduard Urbach
> Cc: Boehm GC
> Subject: [Gc] Re: Fwd: GC_free crash when used with FreeImage library
> 
> Hi Eduard,
> 
> Sorry for the delay. I have no time to reproduce the sample. But it
> looks when you call GC_free that memory is already freed.
> May be someone else on the list has an idea what's wrong.
> 
> Regards,
> Ivan
> 
> Sun, 15 Jul 2012 19:32:40 +0200 Eduard Urbach <e.urbach at gmail.com>:
> > Hi Ivan,
> >
> > I'm copying this message to you because somehow my mailing list
> membership
> > is gone.
> > Maybe you have a quick idea how to solve the problem.
> >
> > Regards,
> > Eduard
> >
> > ---------- Forwarded message ----------
> > From: Eduard Urbach <e.urbach at gmail.com>
> > Date: Wed, Jul 11, 2012 at 11:47 AM
> > Subject: GC_free crash when used with FreeImage library
> > To: Boehm GC <gc at linux.hpl.hp.com>
> >
> >
> > Hello everyone,
> >
> > I'm not sure if I'm doing something wrong: I have a fairly normal
> > installation of bdwgc 7.3 and FreeImage 3.15.3 which is only used in
> this
> > part of my code:
> > https://gist.github.com/3089309
> >
> > When executing FreeImage_Unload() the application segfaults at
> >
> >   Program received signal SIGSEGV, Segmentation fault.
> >
> >   GC_free (p=0x83e92d8) at malloc.c:495
> >
> >   sz = hhdr -> hb_sz;
> >
> >
> > Even if I don't call FreeImage_Unload() the app crashes at the end.
> >
> > If you want to reproduce it, install
> https://github.com/blitzprog/flua and
> > execute the Graphics examples. They all segfault at termination.
> >
> >
> > I tried disabling the GC with GC_disable() for that part of the code
> but
> > that shows no effect.
> >
> > I'm a bit confused right now, hope you can help me find the error
> source or
> > show me whether I did a trivial mistake..
> >
> >
> > Regards,
> >
> > Eduard Urbach
> >
> >
> 
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/



More information about the Gc mailing list