Commit | Line | Data |
7c40a30f |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use FindBin; |
7 | use lib "$FindBin::Bin/../live/lib"; |
8 | |
9 | use Test::More; |
10 | use Catalyst::Test 'TestApp'; |
11956eee |
11 | eval "use GTop"; |
7c40a30f |
12 | |
13 | plan skip_all => 'set TEST_MEMLEAK to enable this test' |
14 | unless $ENV{TEST_MEMLEAK}; |
15 | plan skip_all => 'GTop required for this test' if $@; |
16 | |
17 | plan tests => 1; |
18 | |
19 | { |
20 | # make a request to set initial memory size |
21 | request('http://localhost'); |
22 | |
23 | my $gtop = GTop->new; |
24 | my $initial = $gtop->proc_mem($$)->size; |
25 | print "Initial Size: $initial\n"; |
26 | |
27 | for ( 1 .. 1000 ) { |
28 | request('http://localhost'); |
29 | } |
30 | |
31 | my $final = $gtop->proc_mem($$)->size; |
32 | print "Final Size: $final\n"; |
33 | |
34 | if ( $final > $initial ) { |
35 | print "Leaked Bytes: " . ( $final - $initial ) . "\n"; |
36 | } |
37 | |
38 | is( $final, $initial, 'memory is not leaking' ); |
39 | } |