From: ara.t.howard@... Date: 2007-03-28T05:41:49+09:00 Subject: Re: drb recycled object problem On Wed, 28 Mar 2007, Brian Candler wrote: > 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 drb itself holds a referent to this, the 'front', object - so i don't think that'll help too much. i'm guessing the game returns result objects of some type which are recycled in the server while the client tries to re-use them. cheers. -a -- be kind whenever possible... it is always possible. - the dalai lama