[Catalyst] FormBuilder + C::C::Formbuilder memory leak fixes

Victor Igumnov victori at lamer0.com
Thu Feb 1 20:04:19 GMT 2007


The way its setup with so many circular references I could not figure  
out a way to weaken it correctly for the GC to let it go. Cloning  
seems to work well. It might not be the *best* fix but it works well.  
Concerning C::C::Formbuilder, I ran into a few issues  so disregard  
my patch. At this point I am thinking of sticking formbuilder into  
the model and using it for  data verification and exporting forms.  
Seems like double work when your controller has to verify data and  
then the model.

-Victor


On Jan 31, 2007, at 8:37 PM, Juan Camacho wrote:

> On 1/31/07, Victor Igumnov <victori at lamer0.com> wrote:
>>
>>
>> To see the impact of the memory leak.
>>
>>
>> Run broken.pl first which will run formbuilder against your  
>> installed version.
>> It will create a new formbuilder instance over and over, watch top  
>> -o size as it grows to 100-200 megs in just a few seconds.
>>
>>
>> Now run fixed.pl  - works great don't it? No memory leaks what so  
>> ever.
>>
>>
>> I have also included a CatTest catalyst project which uses  
>> C::C::FormBuilder. With everything patched up the process stays at  
>> ~14 megs while being hammered by ab -n 900 -c 100 http://localhost: 
>> 3000/.
>>
>>
>> So the question is am I the only one using formbuilder? This leak  
>> was very obvious.
>>
>>
>> All tests pass for both projects.
>>
>>
>> http://temp.fabulously40.com/~victori/CGI-FormBuilder-3.05-memfix.tbz
>>
>>
>> -victor
>>
>
> Thank you Victor for pointing out the memory leak. I've attached your
> diff files here to make it easier on folks.
>
> After looking at it, I think your patch is just a workaround for the
> circular references in CGI::FormBuilder and fixing these problems
> directly instead of cloning references is a better approach.  I have
> submitted a bug report to Nate at
> http://rt.cpan.org/Ticket/Display.html?id=24696 and he has already
> said he would look into it.
>
> Juan
> <memfix-for-c-c-formbuilder.diff>
> <memleakfix-for-cgi-formbuilder.diff>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/ 
> catalyst at lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/




More information about the Catalyst mailing list