Out of memory and overcommit_memory setting

From: Antti Lankila
Date: Fri May 28 2004 - 16:54:01 EST



Firstly, I'd want you to look at these two results from the following
command, executed one after other:

% time perl -wle 'sub foo { foo() } foo()'
Deep recursion on subroutine "main::foo" at -e line 1.
zsh: terminated perl -wle 'sub foo { foo() } foo()'
perl -wle 'sub foo { foo() } foo()' 2,19s user 1,17s system 40% cpu 8,355
total
% time perl -wle 'sub foo { foo() } foo()'
Deep recursion on subroutine "main::foo" at -e line 1.
Out of memory!
zsh: exit 1 perl -wle 'sub foo { foo() } foo()'
perl -wle 'sub foo { foo() } foo()' 2,97s user 1,27s system 4% cpu 1:26,54
total

The difference between wallclock time between the runs is an
order-of-magnitude kind. What changed was that the avove (the one which was
running shorter) was run with overcommit_memory enabled, while the latter
(the one that took 1min 26s to recover) was running with overcommit_memory
disabled (which is the default setting).

However, I prefer the former kind of behavoiur. What gives? Why is it better
to run overcommit_memory enabed than disabled?

My kernel is 2.6.5-1-686 as packaged by Debian Sarge.

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