Re: How to persist and query a hash lookup in memory with Perl ?




Quoth Jack <jack_posemsky@xxxxxxxxx>:
<snip: some sort of persistant shared memory>

Thanks I am willing to install Perl Modules, really wondering if there
is a native ability to do it out of the box in Perl.

Well, on systems that support it you can use SysV shared memory, for
which Perl natively has the raw shm* calls. This doesn't work on
Windows, though.

You could try IPC::Shareable for Unix and Win32::MMF::Shareable (which
has the same interface) for Win32, which provide an easier interface to
shared memory.

Another alternative would be mmap, using the Sys::MMap module. mmap is
substantially better behaved than SysV shm, and portable to Windows.

I got persistent memory to work but its not clear how to "pin" a hash
lookup into memory since .pl files and the persistent memory code
example itself are only as good as the life of the execution of the
script !!

In what sense then is this memory 'persistent'? I think you are rather
confused about what is and isn't possible under modern operating
systems: unless you take steps to prevent it, all memory allocated by a
process is released when that process exits. This is a feature :).

Ben

.



Relevant Pages

  • Memory leak, DBI 1.55 + DBD::ODBC 1.13 + MS SQL 2000
    ... Recently I have bumped into a memory leak happening in DBI. ... My Perl build config: ... ActivePerl Build 819 ... 28671 Define PERL_NO_DEV_RANDOM on Windows ...
    (perl.dbi.users)
  • Re: why the perl docs suck
    ... allocate new memory, copy then free old? ... Perl getting to that complex computation. ... >> the granularity of a Perl push statment. ... >> you don't know that memory allocation is not contiguous! ...
    (comp.lang.perl.misc)
  • Re: Multiple "MY" Same Variable - Release Bytes?
    ... Perl do not truly release more memory ... > bytes but rather make that malloc (memory allotment) available for ... arenas, ...
    (comp.lang.perl.misc)
  • Re: Linked lists
    ... Does perl have this concept? ... Linked list helps in good memory management. ... In C you need linked lists because it is expensive and cumbersome to ... collection is called Reference Counting. ...
    (perl.beginners)
  • Re: Zero Rreferences (was:Stupid Question)
    ... > drieux wrote: ... > like its not just on NT that programs retain their memory allocations. ... Think about what happens when you Perl Extension ... Folks need to remember that 'best practice' ...
    (perl.beginners)