On 12/6/2010 8:41 AM, Tridib Bandopadhyay wrote:
> Hello all
> 
> I am trying to do a research on Manual Memory Management and Automatic
> Garbage Collection on Ruby.So i need to play with Garbage Collector code
> of Ruby.I am using Ruby 1.8.6
> 
> I am also trying to figure out in Ruby when the Garbage Collector starts
> working.But didn't got any clue.
> 
> I read somewhere in wiki about some systems that uses this design of
> Memory Allocation.
> 
> Can any one help me in some of my queries:-
> 
> 1. When the Garbage Collector starts working can I see it.(For e.g-It
> will print like Garbage Collector starting.)Somebody referred me use
> GC_NOTIFY but there is no such function in the gc.c file.
> 
> 2. What are the main parts in Ruby Garbage Collector I need to know to
> accomplish this research.
> 
> After I get my first step done I hope I will have many questions to
> share with you all.
> 
> Regards...Eagerly waiting for a reply at the earliest

Have you tried sprinkling some printf statements throughout gc.c
yourself yet?  If the diagnostic instrumentation for gc.c is hard to
find or does not exist, adding your own can at least help you make some
progress.

To start, you could add a printf with the function name at the beginning
of each function in gc.c.  Then run your build of ruby with your test
scripts to trigger garbage collection and see what gets printed.  That
should give you a lead on where to add more printf calls to gc.c in
order to gather more detailed information.

-Jeremy