ulimit -m vs ulimit -v
Thu Apr 22 14:44:00 GMT 2004
I noticed the comment about using "ulimit -m" to prevent a gcj compiled program from consuming all
For those who are not familiar with ulimit, it's a bash built-in command that sets all kinds of
limits on what resources child processes can use.
Typing "ulimit -m" would display the limit for physical memory and "ulimit -m <value>" would set
the limit to some value (in MB, I assume, but I am not sure). I did some experimenting with this
and couldn't get "ulimit -m 5" to stop a simple c program from allocating a 10MB array and filling
it with zeros. I suppose that while the physical memory limit was 5MB, the virtual memory was
unlimited, so what I did was force the kernel to swap some of that array out.
The virtual memory limit, that you set with "ulimit -v <size in KB>", did have the intended
effect. It prevented my C program from taking more than that amount in a malloc.
I am guessing most people would want to limit a gcj compiled java program by setting the -v limit
before executing the program.
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25Â¢
More information about the Java