At Fri, 21 Dec 2001 20:55:41 +0900,
Christian Boos <cboos / bct-technology.com> wrote:
> I saw the patch sent by Nobu Nokada, however I think
> that a better tradeoff can be found,
> 
> 1) Why the nd_file info was kept outside GC, so far?
> 2) Why do we now have a problem if this string is not garbage
>   collected?
> 
> 99.9% of the cases, GC is overkill, because the script is kept
> in memory, and we want to be always able to reference the context
> in which exceptions were thrown.
> In some rare situations (0.1% of the cases, it just surfaced
> recently) the code is just a kind of data/control feed.
> In that later case, I propose ignoring the script filename completely.

I agree it,

> I made the assumption that the distinction between those two cases
> could also match the one already existing between load(f) and load(f,true)
> (the load under an anonymous module).

but don't guess the assumption is true.

> The following patch leads to 0 memory consumption on the
> test case "demo-bug.rb" (see http://www.ruby-talk.org/28754),
> but beside that, I haven't done extensive tests (like the Rubicon
> for instance).

It doesn't pass the following test (modified [ruby-talk:29203]).

  i = 0
  loop {
    fn = format("/tmp/%d.rb", i += 1)
    open(fn, "w") {}
    load fn
    File.unlink fn
  }


Nobu Nakada