From: Yukihiro Matsumoto Date: 2005-10-16T05:16:12+09:00 Subject: Re: Help! define_method leaking procs... Hi, In message "Re: Help! define_method leaking procs..." on Sun, 16 Oct 2005 05:01:58 +0900, Ryan Davis writes: |Someone on IRC made this claim a while ago so I looked into it. Doing |tens of thousands of define_methods certainly increased the memory |footprint, but explicit calls to GC.start every 100 calls or so kept |it to a bare minimum. I don't think it is a real leak, but I could be |wrong. I can talk to you about it in more depth if you grab me later |today or tomorrow. Since define_method creates reference to the block (a closure) which holds reference to the variables in the external scope. So that if it's not a real memory leak, isolating define_method with block by a separate method may help, e.g. changing define_method(:foo){...} to def def_something(name) define_method(name){...} end ... def_something(:foo) matz.