[#237] object.c ruby.h (fwd) — Robert Skarwecki <skaav@...>

Hello everybody,

42 messages 2002/07/24
[#239] Re: [PATCH] object.c ruby.h (fwd) — GOTO Kentaro <gotoken@...> 2002/07/24

At Thu, 25 Jul 2002 00:02:28 +0900,

[#240] Re: [PATCH] object.c ruby.h (fwd) — Dave Thomas <Dave@...> 2002/07/24

GOTO Kentaro <gotoken@notwork.org> writes:

[#246] Re: [PATCH] object.c ruby.h (fwd) — GOTO Kentaro <gotoken@...> 2002/07/25

At Thu, 25 Jul 2002 05:05:46 +0900,

[#247] Re: [PATCH] object.c ruby.h (fwd) — Dave Thomas <Dave@...> 2002/07/25

GOTO Kentaro <gotoken@notwork.org> writes:

[#248] Re: [PATCH] object.c ruby.h (fwd) — nobu.nokada@... 2002/07/25

Hi,

[#249] Re: [PATCH] object.c ruby.h (fwd) — Dave Thomas <Dave@...> 2002/07/25

nobu.nokada@softhome.net writes:

[#250] Re: [PATCH] object.c ruby.h (fwd) — nobu.nokada@... 2002/07/25

Hi,

[#252] Re: [PATCH] object.c ruby.h (fwd) — GOTO Kentaro <gotoken@...> 2002/07/25

At Fri, 26 Jul 2002 03:11:02 +0900,

[#253] Re: [PATCH] object.c ruby.h (fwd) — Dave Thomas <Dave@...> 2002/07/25

GOTO Kentaro <gotoken@notwork.org> writes:

Re: Wiring up the Boehm GC to the Ruby interpreter

From: Jamie Herre <jfh@...>
Date: 2002-07-12 16:05:10 UTC
List: ruby-core #222
Looks like what you've done is to replace ruby's calls to malloc with a 
garbage collected version.  Now you've got two garbage collectors 
running.

To really replace ruby's garbage collector you should change gc.c to 
match your tastes.  The Boehm collector uses essentially the same 
algorithm already used by ruby's garbage collector.

A good place to start might be to disable garbage collection during the 
critical areas of your program via GC#disable and then call 
GC#garbage_collect only when you've got plenty of time - maybe only once 
in a blue moon - maybe never.

-J

------------------------------------------------------
Jamie Herre
Gettys Group Software, Inc.
jfh@gettysgroup.com


On Friday, July 12, 2002, at 03:52 AM, Matthew Bloch (by way of Matthew 
Bloch <mattbee@soup-kitchen.net>) wrote:

> Hi there;
>
> I tried wiring up the Boehm GC (downloaded a couple of days ago) to the
> latest Ruby (from CVS) in an effort to smooth out the interpter's 
> lengthy
> delays in an interactive application written in the language: the only
> changes I made to the Ruby source were:
>
> * changed malloc/realloc/free to call GC_ equivalents like this in 
> ruby.h:
>
>    #ifdef HAVE_BOEHM_GC
>    # include <gc/gc.h>
>    # undef malloc
>    # undef free
>    # undef realloc
>    # define malloc(x) GC_malloc(x)
>    # define free(x) GC_free(x)
>    # define realloc(x,y) GC_realloc(x,y)
>    #endif
>
> * disabled Ruby signal handlers for SIGBUS/SIGSEGV;
> * disabled all the code in rb_gc() and replaced with 
> GC_collect_a_little();
> * GC.enable / .disable / .start methods changed to affect the Boehm GC.
>
> Only problem was-- it leaks!  Or at least the memory use from my 
> application
> went up and up while the standard Ruby collector kept it bounded at 
> around
> 10%.  I could tell it was doing *something* because the memory shot up 
> much
> more quickly if I turned off collection.  Are there any 'roots' in the 
> Ruby
> interpreter that an external GC should need to be told about?  There 
> were no
> shared library dependencies other than the usual libc etc.  Can this 
> *only*
> be because there's memory Boehm doesn't know about, or are there other
> pitfalls to watch out for?
>
> Also, I was a little disappointed not to see any difference 
> 'smoothness' of
> garbage collection between the two GCs-- the Boehm GC still paused the
> application as often despite much fiddling with the global variables 
> that can
> control the frequency & severity of incremental collcetion; is a 
> realistic
> strategy to try to call GC_collect_a_little() every animation frame, 
> with the
> time limit set to, say 10ms?  It didn't seem to stick to this 
> unfortunately
> (though I realise this isn't a guarantee by the collector-- will 10ms 
> always
> be too quick for it to do any useful work?).
>
> Seeing as I'm fairly new to both the Ruby interpreter internals and the 
> Boehm
> GC, I'd appreciate tips on using either.
>
> thanks,
>
> --
> Matthew Bloch                 Bytemark Computer Consulting
>                                 http://www.bytemark.co.uk/
>                                   tel. +44 (0) 8707 455026
>
>

In This Thread