Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Aug 1999 14:18:23 +0400
From:      "Alec Kalinin" <alec@relex.ru>
To:        <freebsd-questions@freebsd.org>
Subject:   Problem with allocation memory in FreeBSD-3.2-RELEASE
Message-ID:  <00e001bee4ac$024ef770$a34562c3@alec.relex.ru>

next in thread | raw e-mail | index | archive | help
Hello!

I have a problem with allocation memory in FreeBSD-3.2-RELEASE. This simple
program hungs my system:

------------------- begin program -----------------------------
#include <unistd.h>
#include <stdlib.h>

#define NALLOC          1000
#define SIZEALLOC       1024*1024
#define WAIT            100

void main()
{
 char *p_mem;
 int i, j;

 if (fork() != 0) return;

 for (i=0; i<NALLOC; i++) {
//     usleep(WAIT);
     p_mem = (char *)malloc(SIZEALLOC);
     for (j=0; j<SIZEALLOC; j++) {
         p_mem[j] = 0;
     }
 }

 while (1);
}
------------------- begin program -----------------------------

I have a swap space about 100 M. After run this program, i can't write
something to my consoles -- system like hang system. But it answer for ping.
It may be my problem, but it may be kernel problem ;)


P.S. My English is not as well, as i want. If you have troubles with read my
letter, sorry.

Good luck,
            Alec



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00e001bee4ac$024ef770$a34562c3>