Re: How does "fork()" work?

2001-03-03 Thread Cameron Simpson
On Wed, Feb 28, 2001 at 12:23:35PM -0800, Living Dead <[EMAIL PROTECTED]> wrote: | I have the following code: | | #define BUFFSIZE 32 * 1024 * 1024 | | int main() | { | char *a; | a = (char *)malloc(BUFFSIZE); | if (fork()) { | // Parent |free(a); | } else { | // Ch

How does "fork()" work?

2001-03-02 Thread Living Dead
I have the following code: #define BUFFSIZE 32 * 1024 * 1024 int main() { char *a; a = (char *)malloc(BUFFSIZE); if (fork()) { // Parent free(a); } else { // Child } } The question is: Is there a risk to run out of memory? To put it in another way: If I all

Re: How does "fork()" work?

2001-02-28 Thread Thornton Prime
On Wed, 28 Feb 2001, Living Dead wrote: > To put it in another way: > If I allocate 32Mb of memory in the parent process, > then I call fork(), the amount of memory needed for > both parent and child is 64Mb? The way Linux works, no, each child doesn't make a full copy in memory. Linux uses a

Re: How does "fork()" work?

2001-02-28 Thread Dave Ihnat
On Wed, Feb 28, 2001 at 12:35:20PM -0800, Living Dead wrote: > I have the following code: > The question is: > Is there a risk to run out of memory? > > To put it in another way: > If I allocate 32Mb of memory in the parent process, > then I call fork(), the amount of memory needed for > both

How does "fork()" work?

2001-02-28 Thread Living Dead
I have the following code: #define BUFFSIZE 32 * 1024 * 1024 int main() { char *a; a = (char *)malloc(BUFFSIZE); if (fork()) { // Parent free(a); } else { // Child } } The question is: Is there a risk to run out of memory? To put it in another way: If I a