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
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
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
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
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