SV: [Gc] Solaris problem

Simon Johansson simon.johansson at
Thu Jul 8 02:29:30 PDT 2004



I change the INITIAL_BUF_SZ and now the warning is gone. That’s good.


I am still running on Solaris when I get the malloc error and I am not
running GC_enable_incremental(), should I?


Program received signal SIGSEGV, Segmentation fault.

[Switching to Thread 304 (LWP 4)]

GC_malloc_atomic (lb=1656) at malloc.c:263

263             *opp = obj_link(op);

(gdb) where

#0  GC_malloc_atomic (lb=1656) at malloc.c:263

#1  0xa25b4 in enqueue ()

#2  0xa2a04 in AddToUnifaceQueue ()

#3  0x7b01c in GetData ()

#4  0x7de40 in Main_CT_Thread ()


(gdb) print opp

$11 = (ptr_t *) 0x7f96d200

(gdb) print op

$12 = 0x34353535 <Address 0x34353535 out of bounds>

(gdb) print *opp

$13 = 0x34353535 <Address 0x34353535 out of bounds>



I get a SIGSEGV error as you can see and the opp and op is out of bounds.
This looks strange.


So I put a sleep before line 263 in the malloc.c and now it works loot
better. But this is not a good way to fix this problem.


When I use the sleep the program will go a long time before it crash the
next time. This is a different part of the program and look like this.


Program received signal SIGSEGV, Segmentation fault.

[Switching to Thread 3173 (LWP 4)]

GC_my_stack_limits () at solaris_threads.c:664

664         register size_t stack_size = me -> stack_size;

(gdb) where

#0  GC_my_stack_limits () at solaris_threads.c:664

#1  0x7f9538ac in GC_old_stacks_are_fresh () at solaris_threads.c:553

#2  0x7f94f404 in GC_read_dirty () at os_dep.c:3150

#3  0x7f9479c4 in GC_initiate_gc () at mark.c:237

#4  0x7f93bf08 in GC_stopped_mark (stop_func=0x7f93af30
<GC_never_stop_func>) at alloc.c:500

#5  0x7f93b990 in GC_try_to_collect_inner (stop_func=0x7f93af30

    at alloc.c:362

#6  0x7f93d358 in GC_collect_or_expand (needed_blocks=1, ignore_off_page=0)
at alloc.c:981

#7  0x7f93d74c in GC_allocobj (sz=14, kind=1) at alloc.c:1056

#8  0x7f945520 in GC_generic_malloc_inner (lb=48, k=1) at malloc.c:134

#9  0x7f9456fc in GC_generic_malloc (lb=48, k=1) at malloc.c:190

#10 0x7f945ba8 in GC_malloc (lb=48) at malloc.c:297

#11 0x58fe8 in _SafeStrdup ()

#12 0x5e450 in _JoinStrings ()

#13 0x98514 in BuildHeaderArea ()

#14 0x50054 in ConstructTrans ()

#15 0x53250 in ResendTrans ()

#16 0x54320 in Main_CS_Thread ()

(gdb) print me

$1 = 0x0


Me is 0. So either the way I get in to problem.





Från: Boehm, Hans [mailto:hans.boehm at] 
Skickat: den 7 juli 2004 21:22
Till: 'Simon Johansson'
Kopia: gc at
Ämne: RE: [Gc] Solaris problem


Try changing INITIAL_BUF_SZ to something like 16384 in os_dep.c.  I just did
that in my source tree.

The old value was a bit of an anachronism.  The warning is also fairly


It looks like you call GC_enable_incremental() to turn on incremental GC?


What's the actual error you're getting?  A segmentation fault or access
violation?  Is it

still on Solaris?  What are the values of op and opp at the point of the


On non-Solaris platforms, segmentation faults are routinely generated and
caught in incremental mode,

often at this point in the code.



-----Original Message-----
From: gc-bounces at [mailto:gc-bounces at]On
Behalf Of Simon Johansson
Sent: Wednesday, July 07, 2004 5:42 AM
To: gc at
Subject: [Gc] Solaris problem



I have two problems. Hopefully someone can help me with this.


The first problem is this warning I get when running the program.


GC Warning: Insufficient space for /proc read 


What is this? Can I change something to get this to work as it should? 


The next problem is a bit more complicated I think. 


I get this error after running the program for a while. The program is a
POSIX C program running on UNIX and Windows and it is multithreaded and
using GC6.2. 


If I use GC_MALLOC_ATTOMIC I get this error:


#0  GC_malloc_atomic (lb=1656) at malloc.c:263

263             *opp = obj_link(op);

(gdb) where

#0  GC_malloc_atomic (lb=1656) at malloc.c:263

#1  0xa24ec in enqueue ()

#2  0xa293c in AddToUnifaceQueue ()

#3  0x7af54 in GetData ()

#4  0x7dd78 in Main_CT_Thread ()



If I use GC_MALLOC I get this almost the same error:


#0  GC_malloc (lb=1656) at malloc.c:303

303             *opp = obj_link(op);

(gdb) where

#0  GC_malloc (lb=1656) at malloc.c:303

#1  0xa24fc in enqueue ()

#2  0xa294c in AddToUnifaceQueue ()

#3  0x7af64 in GetData ()

#4  0x7dd88 in Main_CT_Thread ()



The code there I use malloc look like this.


           if ((p = (elem *)GC_MALLOC_ATOMIC(sizeof(elem))) == NULL)


                      My_Exit (-1, -1, "enqueue" , "Malloc misslyckades.");



Where elem is a struct like this.


struct elem{

           boolean ReturnData;

           HANDLE     UnifaceMutex;

           char *UserName;

           char *Pinghsk;

           DataStructType        d;

           struct elem *next;


typedef struct elem elem;


With a bit of luck someone knows what I shall do.






-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Gc mailing list