Thread: Number of Shared Memory Segments

  1. #1
    Registered User
    Join Date
    Oct 2004

    Question Number of Shared Memory Segments

    I am creating a number of shared memory segments. What I have found is that I can only open 25 segments. On the 26th I get a cannot open shared memory segment error.

    Each object actually creates a shared data object and a jump table in shared memory thus I am actually creating 50 shared memory segments. I need more and I suspect that I am running into a limitation of Linux.

    Running Red Hat 9 and I have tweaked every parameter I can think of. I cannot post the code as it is very large.

    Does anyone know of the limitations on the number of shared memory segments per process? The objects are not very large, less than 1 meg each.

    RH 9 does not seem to allow modification of SHMSEG or even have it in /proc/sys


  2. #2
    Registered User
    Join Date
    Oct 2004


    I am fairly new to Linux development. Most of my time is under WIN 32 After much head banging I discovered that I had exceeded the number of semiphore arrays allowed.....

    Thus the actual solution was to increase the number in /proc/sys/kernel/sem

    Also the max number of segments is shown with ipcs - ml
    In fact, all limits are shown with ipcs - l

    Using this and then running my code I ran ipcs -u for a summary and noticed I had pegged out the number of allowed semiphores.

    I apologize if I posted to soon and hope this helps someone else. I was really stuck....


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. memory issue
    By t014y in forum C Programming
    Replies: 2
    Last Post: 02-21-2009, 12:37 AM
  2. Assignment Operator, Memory and Scope
    By SevenThunders in forum C++ Programming
    Replies: 47
    Last Post: 03-31-2008, 06:22 AM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  4. using shared memory in c
    By flawildcat in forum C Programming
    Replies: 1
    Last Post: 04-09-2002, 12:25 PM
  5. Shared memory in Linux: B-TREE of structures
    By zahid in forum Linux Programming
    Replies: 3
    Last Post: 01-26-2002, 11:15 PM