From: Bob Showalter Date: 2005-10-12T00:15:40+09:00 Subject: Re: comments found in ObjectSpace 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.