Subject: | possible memory leak |
Hello, I think I may have spotted a memory leak in this loop. This code snippet leaks 4 bytes about every ten seconds but without ::EV no memory is leaked:
use IO::Async::Loop::EV;
use IO::Async::Signal;
use IO::Async::Timer::Periodic;
use Memory::Usage;
my $loop = IO::Async::Loop::EV->new();
$loop->add(IO::Async::Signal->new(
'name' => 'INT',
'on_receipt' => sub {
print "notifying loop to stop.\n";
$loop->stop();
return;
}
));
my $timer = IO::Async::Timer::Periodic->new(
'interval' => 1,
'first_interval' => 0,
'reschedule' => 'drift',
'on_tick' => sub {
my $mu = Memory::Usage->new();
$mu->record('start');
$mu->dump();
}
);
$timer->start();
$loop->add($timer);
$loop->run();
Here is info about my enviroment:
uname -a
Linux 2.6.32-358.6.2.el6.x86_64 #1 SMP Tue May 14 15:48:21 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
perl -V
Summary of my perl5 (revision 5 version 18 subversion 4) configuration:
Platform:
osname=linux, osvers=2.6.32-431.1.2.el6.x86_64, archname=linux-linux-thread-multi
uname='linux ad-webdev-uwtc-11.s.uw.edu 2.6.32-431.1.2.el6.x86_64 #1 smp sun nov 24 09:37:37 est 2013 x86_64 x86_64 x86_64 gnulinux '
config_args='-Dusethreads -Duselargefiles -Dccflags=-D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Dldflags= -Wl,-z,relro -Dlddlflags=-shared -Wl,-z,relro -Dcccdlflags=-fPIC -Duse64bitint -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -Ui_libutil -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -Dlibperl=libperl.so -des -Dprefix=/netops/perl -Dprivlib=/netops/perl/lib/5.18 -Darchlib=/netops/perl/lib/5.18 -Dvendorlib=/netops/perl/lib/5.18 -Dvendorarch=/netops/perl/5.18 -Dsitelib=/netops/perl/lib/site_perl/5.18 -Dsitearch=/netops/perl/lib/site_perl/5.18'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Dldflags= -Wl,-z,relro -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -g',
cppflags='-D_REENTRANT -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Dldflags= -Wl,-z,relro -fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='4.4.7 20120313 (Red Hat 4.4.7-11)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.12.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.12'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/netops/perl/lib/5.18/CORE'
cccdlflags='-fPIC', lddlflags='-shared -Wl,-z,relro -L/usr/local/lib -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API
Built under linux
Compiled at Dec 13 2014 12:07:09
%ENV:
PERL5LIB="/netops/lib/perl:"
@INC:
/netops/lib/perl
/netops/perl/lib/site_perl/5.18
/netops/perl/lib/5.18
.