From: Barson Date: 2005-10-12T00:26:52+09:00 Subject: Re: comments found in ObjectSpace Yeah, I am on Windows. > on Windows. I'm guessing this is source code that has previously been > parsed, but not yet garbage collected. If I add ObjectSpace.garbage_collect Great. That explains it. Thanks. "Bob Showalter" wrote in message news:2E4528861499D41199D200A0C9B15BC005EE80AB@fristx.taylorwhite.com... > Amarison wrote: > > I ran the following code: > > > > all = [] > > > > ObjectSpace.each_object do |obj| > > all << obj > > end > > > > File.open('objectspace.txt','w') do |f| > > f.puts all > > end > > > > > > and I was surprised to find comments in objectspace.txt. I was under > > the impression that Ruby skips comments when parsing code. > > > > Very strange behaviour... Anyone cares to explain? Thanks > > I don't see the comments when I run on FreeBSD, but I do see them when I run > on Windows. I'm guessing this is source code that has previously been > parsed, but not yet garbage collected. If I add ObjectSpace.garbage_collect > at the beginning of the program, the source code doesn't show up any longer. > > >