IPC::Shareable size of hash in shared memory or different approach to shared memory

Posted on 2004-11-26
Last Modified: 2008-01-09

I used IPC::Shareable module for my simple webserver solution for three years now. I find it very useful but the module hasn't been updated a while (version 0.6 is more than 3 years old). Anyway I use this module so that server (parent) stores some data into hash and then ties it into the shared memory to which all childs have access. But the default size of shared memory with this module is  65536 bytes and my hash just got bigger so when I try to build this hash I get following error:

Could not create semaphore set: No space left on device
 at lib/ line 170

And when I tried to change the size in options:

my %options = (
create    => 1,
exclusive => 0,
mode      => 0644,
DESTROY   => 1,
size      =>  (IPC::Shareable::SHM_BUFSIZ() * 2)

tie %Data, 'IPC::Shareable', "data", { %options };

Now I get following error:

IPC::Shareable::SharedMem: shmget: Invalid argument
 at /usr/local/ActivePerl-5.8/lib/site_perl/5.8.3/IPC/ line 566
Could not create shared memory segment:
 at lib/ line 165

I tried to contact author of this module but his address on CPAN doesn't exist anymore. So does anyone here have an idea how I can fix this problem or is there perhaps any better (newer) solution for tying hashes in shared memory out there?

Question by:jakac
    LVL 18

    Expert Comment

    by:kandura tells me:

    IPC::ShareLite provides a simple interface to shared memory, allowing data to be efficiently communicated between processes. Your operating system must support SysV IPC (shared memory and semaphores) in order to use this module.

    IPC::ShareLite provides an abstraction of the shared memory and semaphore facilities of SysV IPC, allowing the storage of arbitrarily large data; the module automatically acquires and removes shared memory segments as needed. Storage and retrieval of data is atomic, and locking functions are provided for higher-level synchronization.

    In many respects, this module is similar to IPC::Shareable. However, IPC::ShareLite does not provide a tied interface, does not (automatically) allow the storage of variables, and is written in C for additional speed.
    LVL 18

    Accepted Solution

    by: tells me:

    This module provides a shared memory cache accessed as a tied hash. [...] This module handles all shared memory interaction using the IPC::ShareLite module (version 0.06 and higher) and all data serialization using Storable. See IPC::ShareLite and Storable for details.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Suggested Solutions

    Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
    Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now