lkml.org 
[lkml]   [1999]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectlinux crashed with unchecked malloc ??
Date
hi all,
The problem that I came across was an offshoot of a joke in humorix ,
where linus trovalds plays a role of a detective trying to see why a linux box
crashed and failed to boot again. This is the code I wrote to see how linux
handles the situation

void guess_what ()
{
char *p = malloc (1024*1024);
guess_what ();
}

void main ()
{
guess_what ();
}

I compiled and ran the program once , it segfaulted , and then I ran it twice
again , all the time it segfaulted as expected. But then when I checked up my
hard disk space , I had 0 bytes free. To verify the same , I asked my friend to
run the same code again , except he modified the malloc statement to following:

char *p = malloc (4096*1024);

This time his entire system freezed up , then init reported it has run out of
memory , when we tried to login from another console , klogd said out of memory
and the system just froze , allowing us no chance to kill the culprit process.

We ran the code again after hard reset , and this time we got a bus
error and the program exited. When we checked up the hard disk space we found
again that disk space had been gobbled up leaving a very little amount free.

Any ideas why???

vinny

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

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.051 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site