[plt-scheme] long gc pauses

From: Peter Forbes (symcell at hotmail.com)
Date: Wed Jan 29 21:37:06 EST 2003

I have a small program that links to mzscheme, with the aim to eventually do 
graphics by running scheme programs which will call the GLSCM OpenGL binding 
(GLSCM is listed at http://www.cs.utah.edu/plt/develop/) However, I 
consistently get long (3-4sec) pauses after startup, even without having 
done very much (if any) scheme-related stuff. Breaking during the pause with 
the debugger shows the gc to be at fault. I've played with it a little and 
it seems it's only after the main program has initialized the GL utility 
library (glut - used to create the context in which to call GL commands) 
that a forced gc takes a long time - any forced gc before that goes quickly 
(which seems right.) I've traced into glut and all the initialization seems 
to do is set some global variables and create a window. I guess this could 
affect the collector because it would page in parts of data segments (?) 
from the glut dll. But to such an extent? (a fraction of a second before, 
and 3 - 4 seconds after, without even any calls to scheme in between?)

Here is a call trace of where it pauses:

GC_flush_mark_stack() line 597
push_copied_stacks(int 1) line 115
init_push_copied_stacks() line 138 + 7 bytes
GC_push_roots() line 591
GC_mark_some() line 354 + 11 bytes
GC_stopped_mark() line 496 + 9 bytes
GC_try_to_collect_inner() line 353 + 9 bytes
GC_try_to_collect() line 742 + 9 bytes
GC_gcollect() line 753 + 10 bytes
scheme_collect_garbage() line 626
main(int 2, char * * 0x00c70ec0) line 73
GLENV! mainCRTStartup + 180 bytes
KERNEL32! 77e97d08()

(sorry, but VC doesn't seem to provide filenames or consistent args.)

It is the first GC_flush_mark_stack (setjmpup.c:112) in push_copied_stacks 
that takes a long time (skipping over it in the debugger takes a few 
seconds.) The others that follow in the loop don't seem to.

I'm forcing the collection, but even unforced the same behaviour appears, 
just a little later. glenv is a modified glenv.c from the GLSCM distribution 
- a simple test program.

My machine is an Athlon XP 1700 (1.4GHz) with 256 megs of RAM - but it's not 
swapping during the pause anyway. Windows 2000, mzscheme 203 (debug build.)

I hope this is not a feature. If not, any suggestions on how to fix this 
would be appreciated.


MSN 8 with e-mail virus protection service: 2 months FREE*  

Posted on the users mailing list.