From: Isaac Date: 2002-06-10T23:57:08+09:00 Subject: Re: Park and Sean....Possible memory bug in Ruby? I'm stumped! I believe you were using a file that had been opened inside a block. I think you are using a file that should have fallen out of scope, but due to the nature of GC, whenever it does its cleanup, it will destroy that file. So sometime through your program, the GC mechanism is run and it destroys that file, seemingly at a random point in your file. Read up on how scoping works in Ruby. This is what I gathered from the other responses to the problem, I haven't really looked at your code to hard. PS, please don't change the name of discussions on here. more comments are below: Kurt Euler wrote: > Thanks a lot, Park and Sean. > > Two questions: > > - Sean, what do you mean by CG when you write in your message "This is exactly the type of error that CG causes"? > > - Is there a set limit on the number of files that can be open? If so, how many? > > - Park, you write that one option is this: > > inserta = File.new("./input/intro_subtemplate.txt").read > > should be > > f = File.new("./input/intro_subtemplate.txt") > inserta = f.read > f.close > > but, these statements seem logically (to this newbie) to be logically equivalent. Does the one-line method I used create a phantom file that can't be closed? > They are, he was just giving you another way to write it.