[html-formfu] New Element::Date leaks memory?

Carl Franks fireartist at gmail.com
Fri Aug 24 14:23:48 GMT 2007


On 24/08/07, Tobias Kremer <list at funkreich.de> wrote:
> > Have you confirmed that the process size only grows if Date elements are
> > used?
>
> Yes, forms w/o the Date element aren't suffering from this.
>
> > Are you using auto_inflate(1)?
> > Does the Date have any other constraints, filters, etc?
> > What methods are you calling on the form / date field?
>
> Here's the YAML I used:
>
> ---
> elements:
>   - type: date
>     name: birthdate
>     label: 'Birthdate:'
>     day:
>       prefix: "- Day -"
>     month:
>       prefix: "- Month -"
>     year:
>       prefix: "- Year -"
>       less: 70
>       plus: 0
>     auto_inflate: 1
>
> No other methods are called in the Controller-part on the form.
>
> Maybe this is a Cat-only problem. I reproduced it with a simple Cat-App which
> does nothing but outputting the form above via $c->res->body(). The memory
> usage grows from 27 megs to 44 megs after about 3000 requests (tested with top
> and ab).

Okay, I changed my test to do a stringification - "$form" - and saw
the memory increase.
I also saw a memory increase using just a Text field.

I switched it to use Template::Alloy instead of TT - and the memory
increases disappeared completely (testing 3000 iterations).
You can test this simply by setting the environment variable
HTML_FORMFU_TEMPLATE_ALLOY=1

Looks like the problem's in Template.pm somewhere - maybe the XS stash?

It's perfectly ok to let HTML::FormFu use Template::Alloy internally,
and for you to use TT or any other templating package in the rest of
your app.

Carl



More information about the HTML-FormFu mailing list