[Gc] dangling pointer

Boehm, Hans hans.boehm at hp.com
Tue Nov 9 14:45:46 PST 2004


If GC_malloc is also called from C code, you are right that you
need to make sure that any such C code can be unwound
through, and there's something to catch the exception.
I think the details depend heavily on your environment.
I believe that for gcc the C code would have to be compiled
with -fexceptions for this to work, though I'm not sure that's
required for platforms like linux/ia64 and linux/x86-64 where
unwind info is mandatory.

Hans

> -----Original Message-----
> From: MenTaLguY [mailto:mental at rydia.net]
> Sent: Tuesday, November 09, 2004 2:28 PM
> To: Boehm, Hans
> Cc: Hans Van den Eynden; gc at napali.hpl.hp.com
> Subject: RE: [Gc] dangling pointer
> 
> 
> On Tue, 9 Nov 2004, Boehm, Hans wrote:
> 
> > Continuing the side comment ...
> >
> > You should be able to get the collector to throw an exception
> > instead of returning NULL by assigning a suitable function to
> > GC_oom_fn (and building at least the relevant collector files
> > so that exceptions can be propagated out of the collector.)
> 
> Is it always safe to unwind the stack from GC_oom_fn?
> 
> Even if libgc is safe, that about the case where GC_malloc() has been
> called by another C library?
> 
> -mental
> 


More information about the Gc mailing list