> > You can simply crash the system by issuing "grep any_string /dev/zero".
> > As the lines in /dev/zero have infinite length, grep tries to allocate still more
> > memory for its line buffer until the memory is exhausted. But no out of memory
> > message appear and the system gets frozen (interrupts work, but normal processes
>
> Yes, my system crashes too.
>
> Is this a kernel or a grep problem?
> (i'm running gnu_grep-2.0 and pre-2.0.4)
>
It is sertainly not the grep problem because system can hang with other
programs. Just write small test program which has huge BSS in it. Say,
char a[128*1024*1024];
main()
{
}
Nothing happens to this program when it starts. Top shows it is 128M
large. But if you insert some loop into the code which makes use of the
huge array:
#define LENGTH 128*1024*1024
char a[LENGTH];
main()
{
int i;
for( i=0, i< LENGTH; i++) a[i] = '\0';
}
the program works some time and then stops responding and the only way
out is to press Reset. At least, this is true for my box.
Disclaimer: YOU ARE ON YOUR OWN IF TRY THIS.
Good luck.
Alexey
================================================================
Alexey Yakovlev, Quantum Chemistry lab.
Boreskov Institute of Catalysis, Russian Academy of Sciences
pr. Lavrentieva 5, 630090 Novosibirsk, Russia
phone: +7-(3832)-350264, fax: +7-(3832)-355766
e-mail: jack@catalysis.nsk.su
================================================================