On Thu, 26 Jun 2003 01:26:41 +0900, Mauricio FernáÏdez wrote: > On Wed, Jun 25, 2003 at 11:43:34PM +0900, Simon Strandgaard wrote: >> On Wed, 25 Jun 2003 23:48:00 +0900, Mauricio FernáÏdez wrote: >> >> > On Wed, Jun 25, 2003 at 10:21:37PM +0900, Simon Strandgaard wrote: >> >> On Wed, 25 Jun 2003 22:57:53 +0900, nobu.nokad wrote: >> >> >> >> > #3 Init_stack(address) >> >> > tell GC the machine stack limit. >> >> >> >> I never heard about this before, what does it do ? >> >> Can you give me a more lengthy description of it :-) >> > >> > The GC of Ruby is conservative: it will scan the stack to find VALUEs. >> > This means at any moment it can take the stack pointer and scan from >> > there to the beginning of the stack. Init_stack takes the address of one >> > local variable (in the stack) and records it as the bottom of the stack >> > (highest address in x86). >> >> Sorry I don't understand Nobu's reason to added Init_stack as number 3rd >> item in the list of possible ways to register an instance. >> >> Is Init_stack really a 3rd possiblitity to do registring ? > > It doesn't register one specific instance, but sets the top of the stack > (which will be scanned afterwards) so that the value can be found later. > > You have to call this (directly or via another function) at the > beginning of your program. > > Some references: > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/66013 > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/66025 If I understand you correct, then its a sort of watermark mecanism, where you can take a snapshot of the current state and restore it later ? Is it usable for rubyists whom is doing extensions/embedding ? I think I need to see more examples of its usage before I understand. -- Simon Strandgaard