develooper Front page | perl.beginners | Postings from August 2009

Re: AW: CGI and persistent data (without Storable)

Thread Previous | Thread Next
Chas. Owens
August 28, 2009 07:01
Re: AW: CGI and persistent data (without Storable)
Message ID:
On Fri, Aug 28, 2009 at 08:56, Steve Bertrand<> wrote:
> I understand that doing something like this would be extremely volatile
> and very risky, but to be honest, I'm beyond looking at it as something
> useful, and more interested in knowing if it can be done :)

There are many things that can be done, but that shouldn't.  There is
already a mechanism in the OS to facilitate the sort of storage you
are looking for: shared memory.  The other problem with what you are
trying to do is that no memory is leaked by Perl.  When people talk
about memory being leaked, they are talking about while a given
program is running.  At the end of the program cyclic dependencies
don't matter.  All memory allocated by Perl is returned to the OS.
You can prove this to yourself.  Create a Perl program with a large
leak, such as this


use strict;
use warnings;

        my @a = "a" x (1024*1024*100);
        push @a, \@a;

sleep 1 while 1;

Look at top while it is running, then kill the program and look at
top.  You should see that all of the memory Perl was claiming was
returned to the OS.  So while this might be a good way of temporarily
hiding data in a Perl program (and I am not sure why you would want to
do this, it is not a viable IPC mechanism.

Chas. Owens
The most important skill a programmer can have is the ability to read.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About