Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Forking and sharing variables

by httptech (Chaplain)
on May 21, 2000 at 16:38 UTC ( [id://14019]=note: print w/replies, xml ) Need Help??


in reply to Forking and sharing variables

Ok, a couple of things I ran into. First, you went back to using 'data' as the glue for IPC::Shareable. If I'm not mistaken, this would cause a problem if you had more than one instance of this program running, because they would try to access the same shared memory segment. That's why I was using the pid of the process as the glue.

Also, from what I understand, at the end of the program you need to call IPC::Shareable->clean_up or the shared memory segment persists after the program ends, which is probably not desirable.

The last thing, which is one I couldn't get past, is that I seem to be running out of memory when creating the tied %mxs hash when using your method of defining it. It doesn't happen on a small list, but when I tried it on a list of 200 addresses I get:

IPC::Shareable::SharedMem: shmget: No space left on device at /usr/lib/perl5/site_perl/5.005/IPC/Shareable.pm line 446 Could not create shared memory segment: No space left on device at ./mx.pl line 39
So I added  size => 8000000 to %options and that just led me to plain old Out of memory!

I can't see why it should take more than 8 megabytes of memory to store MX servers for 200 domains. It didn't do this in my example code. But I don't see anything radically different about defining the %mxs hash ahead of time that would cause this.

Any ideas?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://14019]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-06-17 16:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.