Fork functionality question

This is a discussion on Fork functionality question within the C Programming forums, part of the General Programming Boards category; OS: HPUX11 I am thinking of using fork in my program Steps 1. Initialize variables - pointers etc Allocate memory ...

  1. #1
    Unregistered
    Guest

    Fork functionality question

    OS: HPUX11

    I am thinking of using fork in my program

    Steps

    1. Initialize variables - pointers etc
    Allocate memory

    2. fork

    3. do processing

    4. free the memory alloted


    My question is whether fork will create a seperate set of memory locations for all the pointers variables etc... in each process? Because I allocate the memory only once in the parent process but I free the memory in all the parent and child processes.


    Thank you

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,669
    > My question is whether fork will create a seperate set of memory locations for all the pointers variables etc
    That's what the manual says

    > I free the memory in all the parent and child processes
    Sounds good to me

  3. #3
    Unregistered
    Guest
    Thanks Salem

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fork() question
    By cstudent in forum C Programming
    Replies: 3
    Last Post: 04-25-2008, 06:48 AM
  2. Design layer question
    By mdoland in forum C# Programming
    Replies: 0
    Last Post: 10-19-2007, 04:22 AM
  3. Question sorting character arrays: C programming
    By NeoSigma in forum C Programming
    Replies: 3
    Last Post: 05-23-2003, 09:28 PM
  4. Fork() child process question
    By CrackDown in forum Linux Programming
    Replies: 0
    Last Post: 04-17-2003, 11:58 AM
  5. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 08:22 PM

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