[Gc] Strange issues

Shiro Kawai shiro at lava.net
Fri Dec 23 16:52:24 PST 2005


GC only sees the data area as a root set.  In you case
I guess oresult is placed in bss area, for NULL happens
to be all zero bit pattern in your architecture.
Try initializing oresult with some other value, or putting
it in a structure with non-zero initialized variables,
like this:

static struct {
  int foo;
  char *oresult;
} globals = { 1 };

--shiro


From: "Emmanuel Stapf [ES]" <manus at eiffel.com>
Subject: [Gc] Strange issues
Date: Fri, 23 Dec 2005 14:00:56 -0800

> Hi,
> 
> I'm using version 6.5 and I have a case where I have a static C variable which
> points to a structure, which points to another structure and it should never be
> freed. However it does get collected.
> 
> My static variable is defined as:
> 
> volatile char * oresult = NULL;
> 
> Am I missing something?
> 
> Although I believe it should not change anything, I've tried the following 2:
> 1 - store the address of oresult in a pointer allocated by `GC_malloc' it still
> fails
> 2 - store it in a pointer allocated by `GC_malloc_uncollectable' then it works
> fine.
> 
> Regards,
> Manu
> 
>  
> ------------------------------------------------------------------------  
> Eiffel Software	
> 805-685-1006	
> http://www.eiffel.com	
> Customer support: http://support.eiffel.com	
> Product information: mailto:info at eiffel.com	
> User group: http://groups.eiffel.com/join	
> ------------------------------------------------------------------------ 
> 
> _______________________________________________
> 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