From: Ryan Davis Date: 2005-10-16T05:01:58+09:00 Subject: Re: Help! define_method leaking procs... On Oct 15, 2005, at 11:36 AM, Jamis Buck wrote: > A plea for help, here... The rails core team is hacking like mad > this weekend at RubyConf, and my assignment has been to track down > and fix the memory leak in development mode. Here's what is known > about this leak: > > 1. It only occurs in development mode (production mode does not > exhibit the leak) > 2. It only occurs under FastCGI (running under WEBrick does not > exhibit the leak) > 3. The leak is due to an accumulation of Proc objects used with > define_method, primarily in ActiveRecord (the define_method's in > question are used to create the dynamic "has_one", "belongs_to", > "has_many", and "habtm" accessors). The leak may also be due to > define_method's used in ActionMailer, as well. 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.