On Fri, Aug 28, 2009 at 08:56, Steve Bertrand<st...@ibctech.ca> wrote:
snip
> 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 :)
snip

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

#!/usr/bin/perl

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
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to