On Sun, May 18, 2003 at 08:35:11PM +0900, Gaffer wrote:
> i need this for a realtime game application which has embedded ruby -- after
> destroying all objects in my scene and recreating everything, ruby gc takes
> about 10seconds to 'think it through' and collect all garbage... during
> which time the framerate drops in half
> 
> i'd much rather it was all done in one hit in between levels, but i cannot
> find an API to do this, and GC.start seems async
> 
> so,
> 
> assuming GC.start is asynchronous, is there a way to force mark/sweep GC to
> occur, blocking for however long it takes to complete?

AFAIK GC.start forces GC to take place right away:
gc.c

...

rb_define_singleton_method(rb_mGC, "start", rb_gc_start, 0);

...

VALUE
rb_gc_start()
{
    rb_gc();

...
void
rb_gc()
{
 
[marks stuff]

     gc_sweep();
}

-- 
 _           _                             
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ 
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
	Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

<sel> need help: my first packet to my provider gets lost :-(
<netgod> sel:  dont send the first one, start with #2
* netgod is kidding