From: "David A. Black" Date: 2005-10-10T11:33:51+09:00 Subject: Re: using lambda/Proc can prevent a lot of garbage collection Hi -- On Mon, 10 Oct 2005, Eric Mahurin wrote: > Well, C's malloc and free also work as advertised. And you can > easily make a C program that has a memory leak if you don't > pair these properly. You can blame it on the C > language/library or you can blame it on the C programmer, but > either way there is a memory leak when you don't pair these > properly. I see the above case as the same. Here is the > definition of "memory leak" I found on > http://www.webopedia.com/TERM/M/memory_leak.html : > > "A bug in a program that prevents it from freeing up memory > that it no longer needs" > > In the first example above that is what is going on. The > program is not freeing memory it no longer needs. Again, you > can blame this on the ruby programmer or the ruby langauge. > Since this is usually unwanted and/or unexpected, I choose to > blame the language. The problem, though, is that the need (or lack thereof) can't be determined, isn't it? It's not even safe to assume that the presence of "eval" means "don't free the memory", nor that its absence means not to. I mean, it's unlikely that someone would do: alias :blah :eval x = lambda { blah("x") } but it's possible. David -- David A. Black dblack@wobblini.net