Subject: | Certain form fields (e.g. selectbox) cause a memory leak |
Here's a simple example which shows that using a selectbox field causes
a memory leak. If you omit the options key, the leak goes away.
Downgrade to Rose::HTML::Form 0.549 and the leak is gone, too. Simple
text fields seem to work fine. Every version from 0.550 upwards seems to
be affected.
package LeakForm;
use Rose::HTML::Form;
use base qw/ Rose::HTML::Form /;
sub build_form {
shift->add_fields(
myfield => {
type => 'selectbox',
options => [ 'm' => { label => 'aLabel' } ],
},
);
}
package main;
my $last_size = 0;
for( 0..1000 ) {
my $form = LeakForm->new();
# Check process size (needs linux)
open my $proc, '<', '/proc/self/statm';
my( $size, $share ) = ( 0, 0 );
( $size, $share ) = ( split /\s/, scalar <$proc> )[0,2];
close $proc;
if( $size > $last_size ) {
print "$size (+" . ($size - $last_size) . ")\n";
$last_size = $size;
}
}