cleen has asked for the wisdom of the Perl Monks concerning the following question:

Ok, this may be one of the dumbest "I didnt RTFM" type question, and mabye Im a bit confused on how shmem works, but I am utilizing IPC::Shareable in a program of mine to store a hash of hashes into memory, so the next time the program runs, it can do what it was needs to do and see what has changed within the hash.
Here is the stuff that gets tied into memory
use IPC::Shareable; my %peering; my %lastpeering; my %options_now = ( create => 'yes', exclusive => 'no', mode => 0666, destroy => 'no' ); my %options_then = ( create => 'yes', exclusive => 'no', mode => 0666, destroy => 'no' ); tie %lastpeering, 'IPC::Shareable', $glue, \%options2 or die "tie fa +iled\n"; tie %peering, 'IPC::Shareable', $glue, \%options or die "tie failed\n" +;
....... Ok everything is fine and dandy, I can get the information back fine on the next run and see what was in %lastpeering from memory, but uhhh:
ipcs ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status + 0x30787566 896513 mthomas 666 65536 0 + 0x0000715f 896515 mthomas 666 65536 0 + 0x0004d733 896516 mthomas 666 65536 0 + 0x000d0241 896517 mthomas 666 65536 0 + 0x00001058 896518 mthomas 666 65536 0 + 0x000f1708 896519 mthomas 666 65536 0 + 0x00078ab1 896520 mthomas 666 65536 0 + 0x00023842 896521 mthomas 666 65536 0 + 0x00011d03 896522 mthomas 666 65536 0 + 0x00094861 896523 mthomas 666 65536 0 + 0x000c10f3 896524 mthomas 666 65536 0 + 0x0000e876 896525 mthomas 666 65536 0 + 0x00023a9c 896526 mthomas 666 65536 0 + 0x000071f6 896527 mthomas 666 65536 0 + ------ Semaphore Arrays -------- key semid owner perms nsems status 0x30787566 896640 mthomas 666 2 0x0000715f 896642 mthomas 666 2 0x0004d733 896643 mthomas 666 2 0x000d0241 896644 mthomas 666 2 0x00001058 896645 mthomas 666 2 0x000f1708 896646 mthomas 666 2 0x00078ab1 896647 mthomas 666 2 0x00023842 896648 mthomas 666 2 0x00011d03 896649 mthomas 666 2 0x00094861 896650 mthomas 666 2 0x000c10f3 896651 mthomas 666 2 0x0000e876 896652 mthomas 666 2 0x00023a9c 896653 mthomas 666 2 0x000071f6 896654 mthomas 666 2


That was only after one run of the program, (I cleared all previous from mem manually using ipcrm), now my question is, is it SUPPOSED to do that? It looks as if its creating a new memory handle for each $blah{new memory}{new memory}{new memory}, as I stated before, the hash in which I am attempting to put into memory is a hash of hash's. Any input would be grand! Thanks,
Mark

Replies are listed 'Best First'.
Re: IPC Shared Memory Question
by cleen (Pilgrim) on Mar 03, 2001 at 09:15 UTC
    Ok, thanks to jcwren, even after sitting and staring at the perldoc for IPC::Shareable I was pointed to the answer within the manual.
    "Secondly, since a new shared memory segment is created for each thingy being referenced"

    Thanks to all who helped.
Re: IPC Shared Memory Question
by cleen (Pilgrim) on Mar 03, 2001 at 09:08 UTC
    To make it even a shorter question, the basic jist of that whole post was the question of "Does each hash inside a hash of hash's get put into its own memory handle".

    I looked at elements in the hash vs. what showed up on ipcs, ipcs seeminly has the same number of handles - 1 each time.