[Gc] Segfaults in GC_core_malloc

Andrew Haley aph at redhat.com
Tue Feb 13 01:48:32 PST 2007


Andrei Golovizin writes:
 > Hello,
 > 
 > I am currently porting some old (and apparently broken) program to libgc.
 > I am using libgc.so built with --enable-redirect-malloc. Unfortunately the 
 > program segfaults quite often. Here is the example backtrace:
 > 
 > -------8<----------------------------------------------------------------------
 > #0  GC_core_malloc (lb=64) at malloc.c:280
 > #1  0x080ebe08 in GC_malloc (bytes=64) at thread_local_alloc.c:150
 > #2  0x080e6da6 in GC_realloc (p=0x90ea320, lb=64) at mallocx.c:130
 > #3  0x001a92a2 in XShrinkRegion () from /usr/X11R6/lib/libX11.so.6
 > #4  0x001a8ad9 in XOffsetRegion () from /usr/X11R6/lib/libX11.so.6
 > #5  0x001a8c7b in XUnionRegion () from /usr/X11R6/lib/libX11.so.6
 > #6  0x001a8dd4 in XUnionRectWithRegion () from /usr/X11R6/lib/libX11.so.6
 > #7  0x00137047 in XtAddExposureToRegion () from /usr/X11R6/lib/libXt.so.6
 > #8  0x001376a6 in XtDispatchEventToWidget () from /usr/X11R6/lib/libXt.so.6
 > #9  0x00137d5f in _XtOnGrabList () from /usr/X11R6/lib/libXt.so.6
 > #10 0x001380c9 in XtDispatchEvent () from /usr/X11R6/lib/libXt.so.6
 > #11 0x08213375 in pxinpt_ ()
 > #12 0x0806fb7e in egw_app_shdn (subnam=0xbff2ea70 "pxinpt_", ier=0xbff2ea2c) 
 > at egw_app_subs.c:395
 > #13 0x0806f20a in egw_app_strt (argc=1, argv=0xbff2eb34, 
 > subnam=0xbff2ea70 "pxinpt_", ier=0xbff2ea2c) at egw_app_subs.c:109
 > #14 0x08051fd3 in main (argc=1, argv=0xbff2eb34) at ebh001.c:111
 > -------8<----------------------------------------------------------------------
 > 
 > I've also tried emulating libgc behaviour by simply replacing free() with a 
 > do-nothing function instead of using real libgc. In this case segfaults never 
 > occur (although the memory leaks badly).
 > 
 > Is such behaviour of GC expected? If yes, is it possible to know, what is 
 > causing it? I'm completely stuck now and will appreciate any help. :)

You're trashing memory.  Have you ever run the program under
Valgrind's Memcheck?

Andrew.


More information about the Gc mailing list