problems with Memoize::Storable
problems with Memoize::Storable
am 22.02.2007 22:54:10 von Daniel McBrearty
hi,
short script to try to use this module:
#!/usr/bin/perl
use strict;
use warnings;
use Memoize qw( memoize unmemoize );
use Memoize::Storable;
tie my %cache => 'Memoize::Storable', 'cache_file';
memoize 'doit', SCALAR_CACHE => [HASH => \%cache];
print "before : \n";
doit();
print "after : \n";
sub doit {
for ( 1 .. 10 ){
unless (exists $cache{$_}){
print "adding $_\n";
$cache{$_} = "blah $_";
}
}
}
when I run it, I get:
daniel@daniel-ubuntu:~/tmp$ ./memoize_st.pl
before :
adding 1
adding 2
adding 3
adding 4
adding 5
adding 6
adding 7
adding 8
adding 9
adding 10
after :
Segmentation fault
I've checked, both Memoize and Memoize::Storable are up to date.
what could be the issue? any ideas?
thanks, Daniel
PS maybe this helps .. :
daniel@daniel-ubuntu:~/tmp$ perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=linux, osvers=2.6.15-27-386, archname=i686-linux-thread-
multi
uname='linux daniel-ubuntu 2.6.15-27-386 #1 preempt sat sep 16
01:51:59 utc 2006 i686 gnulinux '
config_args='-d -Dusethreads'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -
fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/
include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-
strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/
include'
ccversion='', gccversion='4.0.3 (Ubuntu 4.0.3-1ubuntu5)',
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.3.6.so, so=so, useshrplib=false,
libperl=libperl.a
gnulibc_version='2.3.6'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP THREADS_HAVE_PIDS
USE_ITHREADS
USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
Built under linux
Compiled at Sep 19 2006 16:22:00
@INC:
/usr/local/lib/perl5/5.8.8/i686-linux-thread-multi
/usr/local/lib/perl5/5.8.8
/usr/local/lib/perl5/site_perl/5.8.8/i686-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.8.8
/usr/local/lib/perl5/site_perl
.
Re: problems with Memoize::Storable
am 23.02.2007 06:46:16 von paduille.4060.mumia.w+nospam
On 02/22/2007 03:54 PM, danielmcbrearty@gmail.com wrote:
> hi,
>
> short script to try to use this module:
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> use Memoize qw( memoize unmemoize );
> use Memoize::Storable;
>
> tie my %cache => 'Memoize::Storable', 'cache_file';
> memoize 'doit', SCALAR_CACHE => [HASH => \%cache];
>
> print "before : \n";
> doit();
> print "after : \n";
>
> sub doit {
> for ( 1 .. 10 ){
> unless (exists $cache{$_}){
> print "adding $_\n";
> $cache{$_} = "blah $_";
> }
> }
> }
>
> when I run it, I get:
> daniel@daniel-ubuntu:~/tmp$ ./memoize_st.pl
> before :
> adding 1
> adding 2
> adding 3
> adding 4
> adding 5
> adding 6
> adding 7
> adding 8
> adding 9
> adding 10
> after :
> Segmentation fault
>
> I've checked, both Memoize and Memoize::Storable are up to date.
>
> what could be the issue? any ideas?
>
> thanks, Daniel
>
If you fail to "untie %cache;" before the program exits, it segfaults. I
have no idea if this is a bug or not.
My system:
Perl 5.9.4
Debian 3.1 (i386)
Memoize 1.01
Memoize::Storable 0.65
> PS maybe this helps .. :
>
> daniel@daniel-ubuntu:~/tmp$ perl -V
> Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
> Platform:
> osname=linux, osvers=2.6.15-27-386, archname=i686-linux-thread-
> multi
> uname='linux daniel-ubuntu 2.6.15-27-386 #1 preempt sat sep 16
> 01:51:59 utc 2006 i686 gnulinux '
> config_args='-d -Dusethreads'
> hint=recommended, useposix=true, d_sigaction=define
> usethreads=define use5005threads=undef useithreads=define
> usemultiplicity=define
> useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
> use64bitint=undef use64bitall=undef uselongdouble=undef
> usemymalloc=n, bincompat5005=undef
> Compiler:
> cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -
> fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/
> include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
> optimize='-O2',
> cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-
> strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/
> include'
> ccversion='', gccversion='4.0.3 (Ubuntu 4.0.3-1ubuntu5)',
> gccosandvers=''
> intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
> d_longlong=define, longlongsize=8, d_longdbl=define,
> longdblsize=12
> ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
> lseeksize=8
> alignbytes=4, prototype=define
> Linker and Libraries:
> ld='cc', ldflags =' -L/usr/local/lib'
> libpth=/usr/local/lib /lib /usr/lib
> libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
> perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
> libc=/lib/libc-2.3.6.so, so=so, useshrplib=false,
> libperl=libperl.a
> gnulibc_version='2.3.6'
> Dynamic Linking:
> dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
> cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
>
>
> Characteristics of this binary (from libperl):
> Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
> PERL_MALLOC_WRAP THREADS_HAVE_PIDS
> USE_ITHREADS
> USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
> Built under linux
> Compiled at Sep 19 2006 16:22:00
> @INC:
> /usr/local/lib/perl5/5.8.8/i686-linux-thread-multi
> /usr/local/lib/perl5/5.8.8
> /usr/local/lib/perl5/site_perl/5.8.8/i686-linux-thread-multi
> /usr/local/lib/perl5/site_perl/5.8.8
> /usr/local/lib/perl5/site_perl
> .
>
--
Windows Vista and your freedom in conflict:
http://www.badvista.org/
Re: problems with Memoize::Storable
am 23.02.2007 12:03:41 von Daniel McBrearty
Indeed, that seems to cure. I can't figure out quite why this is
either. I'll mail MJD and ask. A core dump does seem a bit extreme.
thanks for the help.
On 23 Feb, 06:46, "Mumia W."
+nos...@earthlink.net> wrote:
> On 02/22/2007 03:54 PM, danielmcbrea...@gmail.com wrote:
>
>
>
> > hi,
>
> > short script to try to use this module:
>
> > #!/usr/bin/perl
> > use strict;
> > use warnings;
>
> > use Memoize qw( memoize unmemoize );
> > use Memoize::Storable;
>
> > tie my %cache => 'Memoize::Storable', 'cache_file';
> > memoize 'doit', SCALAR_CACHE => [HASH => \%cache];
>
> > print "before : \n";
> > doit();
> > print "after : \n";
>
> > sub doit {
> > for ( 1 .. 10 ){
> > unless (exists $cache{$_}){
> > print "adding $_\n";
> > $cache{$_} = "blah $_";
> > }
> > }
> > }
>
> > when I run it, I get:
> > daniel@daniel-ubuntu:~/tmp$ ./memoize_st.pl
> > before :
> > adding 1
> > adding 2
> > adding 3
> > adding 4
> > adding 5
> > adding 6
> > adding 7
> > adding 8
> > adding 9
> > adding 10
> > after :
> > Segmentation fault
>
> > I've checked, both Memoize and Memoize::Storable are up to date.
>
> > what could be the issue? any ideas?
>
> > thanks, Daniel
>
> If you fail to "untie %cache;" before the program exits, it segfaults. I
> have no idea if this is a bug or not.
>
> My system:
> Perl 5.9.4
> Debian 3.1 (i386)
> Memoize 1.01
> Memoize::Storable 0.65
>
>
>
> > PS maybe this helps .. :
>
> > daniel@daniel-ubuntu:~/tmp$ perl -V
> > Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
> > Platform:
> > osname=linux, osvers=2.6.15-27-386, archname=i686-linux-thread-
> > multi
> > uname='linux daniel-ubuntu 2.6.15-27-386 #1 preempt sat sep 16
> > 01:51:59 utc 2006 i686 gnulinux '
> > config_args='-d -Dusethreads'
> > hint=recommended, useposix=true, d_sigaction=define
> > usethreads=define use5005threads=undef useithreads=define
> > usemultiplicity=define
> > useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
> > use64bitint=undef use64bitall=undef uselongdouble=undef
> > usemymalloc=n, bincompat5005=undef
> > Compiler:
> > cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -
> > fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/
> > include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
> > optimize='-O2',
> > cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-
> > strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/
> > include'
> > ccversion='', gccversion='4.0.3 (Ubuntu 4.0.3-1ubuntu5)',
> > gccosandvers=''
> > intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
> > d_longlong=define, longlongsize=8, d_longdbl=define,
> > longdblsize=12
> > ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
> > lseeksize=8
> > alignbytes=4, prototype=define
> > Linker and Libraries:
> > ld='cc', ldflags =' -L/usr/local/lib'
> > libpth=/usr/local/lib /lib /usr/lib
> > libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
> > perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
> > libc=/lib/libc-2.3.6.so, so=so, useshrplib=false,
> > libperl=libperl.a
> > gnulibc_version='2.3.6'
> > Dynamic Linking:
> > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
> > cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
>
> > Characteristics of this binary (from libperl):
> > Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
> > PERL_MALLOC_WRAP THREADS_HAVE_PIDS
> > USE_ITHREADS
> > USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
> > Built under linux
> > Compiled at Sep 19 2006 16:22:00
> > @INC:
> > /usr/local/lib/perl5/5.8.8/i686-linux-thread-multi
> > /usr/local/lib/perl5/5.8.8
> > /usr/local/lib/perl5/site_perl/5.8.8/i686-linux-thread-multi
> > /usr/local/lib/perl5/site_perl/5.8.8
> > /usr/local/lib/perl5/site_perl
> > .
>
> --
> Windows Vista and your freedom in conflict:http://www.badvista.org/