This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ulimit -m vs ulimit -v


I noticed the comment about using "ulimit -m" to prevent a gcj compiled program from consuming all
available memory.

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.

Chris Marshall



	
		
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]