-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Troy Davis wrote:
> I've got a bit of a strange problem that I'm having trouble nailing down.
> At first glance, it appears the $m->print makes memory disappear. This is
> actually a subset of a larger problem with leaky memory that I'm trying to
> fix. This is the smallest reproducible problem of the lot.
Using the attached test, I was not able to reproduce your problem on these
systems:
1)
Linux 2.6.22.9
httpd 2.2.6
mod_perl 2.0.3
libapreq2-2.09
HTML-Mason 1.37
CGI 3.15
2)
Linux 2.6.23
httpd 1.3.39
mod_perl 1.30
libapreq 1.33
HTML-Mason 1.37
CGI 3.29
'HTH.
- --
Marius Feraru
-----BEGIN PGP SIGNATURE-----
iD8DBQFHGfOLtZHp/AYZiNkRAm3lAKDaiK9d28NfVAvfmtanH7v2RfMc6gCfQtz6
vEbHD2FbkuxLBRyjItA3rOY=
=JJ2q
-----END PGP SIGNATURE-----
#
# kludged from 08-ah.t
#
use strict;
use warnings;
use File::Spec;
use HTML::Mason::Tests;
use Module::Build;
use Test::More;
eval "use GTop";
plan skip_all => "GTop not installed." if $@;
my $gtop = GTop->new;
my $test_data = eval { Module::Build->current->notes('test_data') };
# Skip test if no mod_perl
eval { require mod_perl2 };
if ($@) {
eval { require mod_perl };
}
my $mpver;
{
no warnings 'once';
$mpver = ( $mod_perl2::VERSION || $mod_perl::VERSION );
}
my $apreq_module
= $mpver && $mpver >= 2 ? 'Apache2::Request' : 'Apache::Request';
unless ( $test_data
&& $test_data->{is_maintainer}
&& exists $test_data->{apache_dir}
&& $test_data->{apache_dir}
&& -d $test_data->{apache_dir} )
{
plan skip_all => '$test_data->{is_maintainer} is not true or '
. '$test_data->{apache_dir} is not a directory';
}
use lib 'lib', File::Spec->catdir( 't', 'lib' );
require File::Spec->catfile( 't', 'live_server_lib.pl' );
use Apache::test qw(skip_test have_httpd have_module);
plan skip_all => 'have_httpd evaluates false.' unless have_httpd();
local $| = 1;
# needed for Apache::test->fetch to work
local $ENV{PORT} = $test_data->{port};
kill_httpd(1);
test_load_apache();
print STDERR "\n";
my $comp_code = q{
<%flags>
inherit => undef
</%flags>
};
if ($mpver && $mpver >= 2) {
$comp_code .= q{
<%once>
use Apache2::Response;
</%once>
};
}
if ($mpver && $mpver < 2) {
$comp_code .= q{
<%once>
use Apache::File;
</%once>
};
}
$comp_code .= q{
<%init>
my $contents = 'a' x 2**20;
$m->auto_send_headers(0);
$m->clear_buffer;
$r->content_type('application/octet-stream; name=test');
$r->set_content_length(bytes::length($contents));
$r->set_last_modified(time);
my %headers = (
'Cache-Control' => 'max-age=3600,must-revalidate',
'Content-Disposition' => 'attachment; filename=test',
'Content-Transfer-Encoding' => 'binary',
);
if ($r->can('header_out')) {
while (my ($k,$v) = each %headers) {
$r->header_out($k => $v);
}
} elsif ($r->can('headers_out')) {
while (my ($k,$v) = each %headers) {
$r->headers_out->{$k} = $v;
}
}
if ($r->can('send_http_header')) {
$r->send_http_header;
}
$m->autoflush(1);
$m->print($contents);
undef $contents;
$m->autoflush(0);
$m->abort;
</%init>
};
write_comp( 'large_print', $comp_code );
my $tests_no = 0;
my $iterations = 100;
$tests_no += 2 * $iterations if have_module($apreq_module);
$tests_no += 2 * $iterations if have_module('CGI');
plan tests => $tests_no;
my $contents = 'a' x 2**20;
large_print_tests('mod_perl') if have_module($apreq_module);
large_print_tests('CGI') if have_module('CGI');
exit 0;
sub mem_stats {
my $pid = get_pid();
my $pmem = $gtop->proc_mem($pid);
return {
pid => $pid,
vsize => $pmem->vsize,
rss => $pmem->rss,
};
}
sub large_print_tests {
my ($handler) = @_;
cleanup_data_dir();
start_httpd( $handler . '_no_handler' );
my $msi = mem_stats();
my $iteration = 0;
while ( $iteration++ < $iterations ) {
my $response = Apache::test->fetch('/comps/large_print');
my $success = HTML::Mason::Tests->tests_class->check_output(
actual => $response->content,
expect => $contents
);
ok( $success, "fetch large_print [$handler]" );
my $ms = mem_stats();
is_deeply( $ms, $msi, 'httpd process memory');
}
kill_httpd(1);
cleanup_data_dir();
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users