File: memory_leak.t

package info (click to toggle)
libfilehandle-unget-perl 0.1634-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 324 kB
  • sloc: perl: 2,160; makefile: 2
file content (26 lines) | stat: -rwxr-xr-x 501 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use strict;
use FileHandle::Unget;
use Test::More tests => 1;

eval 'require Devel::Leak';

# For initial memory allocation
new FileHandle::Unget();

# Check for memory leaks.
SKIP:
{
  skip('Devel::Leak not installed',1) unless defined $Devel::Leak::VERSION;

  my $fhu_handle;

  my $start_fhu = Devel::Leak::NoteSV($fhu_handle);

  my $fhu = new FileHandle::Unget();
  undef $fhu;

  my $end_fhu = Devel::Leak::NoteSV($fhu_handle);

  # 1
  cmp_ok($end_fhu - $start_fhu, '<=', 0, 'Memory leak');
}