Re: Allocation of too much memory hangs system, kernel 2.2.*

Juergen Vollmer (vollmer@cocolab.de)
Thu, 27 May 1999 09:26:44 +0200


--==_Exmh_2041577644P
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi dear Giuliano,
> > [1.] One line summary of the problem:
> > Allocation of too much memory hangs system, kernel 2.2.*
> >
> > [2.] Full description of the problem/report:
> > a) An (erronous) program allocates memory in some kind of endless
> loop.
> > After some while the system hangs.

> Hmm, I wrote these 2 simple prgms:

> //********** 1 ***
> void foo(){
> char a[16384];
> foo();
> }
> void main(){
> foo();
> }
> //********** 2 ***
> void main(){
> void *i;
> while(1) i=3Dmalloc(16384);
> }

> Program #1 ends with a huge core dump.
> Program #2 ends with a core too, but it is very little, about 8MB.
> Strange.

> Anyway the machine is still OK and prefectily working and stable. You
> should
> post the peice of code that cause you that troubles...

Please try the following:

-------------------------------------
# include "stdio.h"

static int count =3D 0;
# define MAX (1024*1024)
void foo(){
char a[MAX];
int i;

printf ("%d\n", count++);

for (i =3D 0; i < MAX; i +=3D 100) {
a[i] =3D i % 256;
}

foo();
}
int main(){
foo();
return 0;
}
-------------------------------------

after printing 375, the system stops as described in my problem report.

J=FCrgen

-------------------------------------------------------------------------=
-----
Dr. Juergen Vollmer, Viktoriastrasse 15, D-76133 Karlsruhe
office: vollmer@cocolab.de Tel: +49(721) 9204871 Fax: +49(721) =
24874
private: Juergen.Vollmer@acm.org Tel: +49(721) 24874 Fax: +49(721) =
24874
WWW: www.cocolab.de/vollmer
-------------------------------------------------------------------------=
-----

--==_Exmh_2041577644P
Content-Type: application/pgp-signature

-----BEGIN PGP MESSAGE-----
Version: 2.6.3i
Comment: Requires PGP version 2.6 or later.

iQCVAwUBN0zzs4h48drK23N9AQFCXgP8DtM7uvwg0EL4OX7DDBk6yKdiBbcmx9qZ
ok0IBgfdV1zJhopDKVZVTU0QaPWO2IOIR2fxikDIU7EPoh4ldQ8L2AI2OTJyPCEz
JVSunBqr2CsqvMk1/ySZn0KbZOZbaV8RxolJ+PYekWox13XwaXfJGqdIsgWsyMZf
xwsBXox52r8=
=RoDq
-----END PGP MESSAGE-----

--==_Exmh_2041577644P--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/