From: Eric Hodel Date: 2005-01-20T09:04:44+09:00 Subject: Re: 1.8.2 - conituations memory leak fixed? --Apple-Mail-33--976818807 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 19 Jan 2005, at 11:36, Michael Neumann wrote: > Am Mittwoch 19 Januar 2005 19:35 schrieb Eric Hodel: >> On 19 Jan 2005, at 08:15, Michael Neumann wrote: >>> Am Mittwoch 19 Januar 2005 16:53 schrieb ts: >>>>>>>>> "j" == jc writes: >>>> >>>> j> This was posted recently: >>>> j> >>>> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/124213 >>>> >>>> This is the proof that the GC is conservative, this does not mean >>>> that it >>>> exist a memory leak. >>> >>> Sure, but the results might be the same ;-) >> >> I don't see a callcc in there anywhere, so >> callback_stream.with_callbacks_for could be doing other naughty >> things. > > Right. But it's the place where the callbacks are invoked. And the > callback > that gets invoked actually uses callcc. It was very strange that, when > I > change that line in some manner (introduce an assignment), the memory > consumption changes drastically. Due to the way Ruby saves the environment, the problem could be on the line you show, or it could be where callcc is invoked. Without a simple testcase, its difficult to track this problem down to a memory leak, or a result of the conservative GC/environment feature: def x w = :stuff proc do # w is free in this proc, so we don't need to save any reference to it # in the proc puts "w: #{eval "w"}" # grab w out of the environment end end x.call # prints w: stuff # Because ruby keeps the entire local variable table around, we can get to w -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --Apple-Mail-33--976818807 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iD8DBQFB7vVIMypVHHlsnwQRAoO6AJwPG9SW27wpBmTLbxWUwi9GwZze9QCgpYuF EEFhp1l2al1e0SESepfRiWs= =zqsC -----END PGP SIGNATURE----- --Apple-Mail-33--976818807--