how to release shared memory (fork)?

This is a discussion on how to release shared memory (fork)? within the C Programming forums, part of the General Programming Boards category; I have one variable that is shared with 3 different process. i want parent to release shared memory before ending ...

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    1

    how to release shared memory (fork)?

    I have one variable that is shared with 3 different process. i want parent to release shared memory before ending the program.

    How do i achieve this?

    Thank You.

  2. #2
    Registered User
    Join Date
    Sep 2008
    Posts
    200
    Get each process to shm_unlink() the shared memory - once they have all done this, the shared memory will be released.
    Programming and other random guff: cat /dev/thoughts > blogspot.com (previously prognix.blogspot.com)

    ~~~

    "The largest-scale pattern in the history of Unix is this: when and where Unix has adhered most closely to open-source practices, it has prospered. Attempts to proprietarize it have invariably resulted in stagnation and decline."

    Eric Raymond, The Art of Unix Programming

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fork with shared memory
    By El_Kabong in forum C Programming
    Replies: 1
    Last Post: 11-03-2011, 03:49 PM
  2. Replies: 1
    Last Post: 09-19-2010, 06:21 PM
  3. don't we need to release memory before exit(1)?
    By patiobarbecue in forum C Programming
    Replies: 1
    Last Post: 03-22-2010, 09:12 AM
  4. will it auto release memory
    By rchiu5hk in forum C++ Programming
    Replies: 4
    Last Post: 09-16-2009, 03:32 AM
  5. Shared fd after a fork()
    By Andaluz in forum Linux Programming
    Replies: 3
    Last Post: 03-20-2009, 02:57 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21