Brian Candler
3/27/2007 6:37:00 PM
On Tue, Mar 27, 2007 at 08:39:36PM +0900, Raj Sahae wrote:
> ara.t.howard@noaa.gov wrote:
> >yeah. terrible idea.
> >
> >you just need to keep a reference to it to prevent it from being
> >gc'd. can
> >you show use some code?
> >
> >-a
> Snipping code would be tricky. It's a fairly large program. None of
> the objects that are important are ever, EVER, not referenced somehow.
> Everything is stored in arrays, and transferred around in arrays.
> Objects on the server are moved from array to array by the client
> calling methods using DRb. What kind of code would you want me to show
> you to prove this?
>
> # on the server
> DRb.start_service($uri, server.game)
$foo = server.game
DRb.start_service($uri, $foo)
Keeping a reference to the object in global variable $foo is one way to stop
it frm being garbage collected.
A local variable is fine, as long as it doesn't drop out of scope: e.g.
foo = server.game
DRb.start_service($uri, foo)
DRb.thread.join # program waits here