Question:
Is there a Linux version that will allow Java to take more memory?
A J
2012-06-12 16:15:39 UTC
I have a program I need to run which requires that the JRE use more than the relatively small amounts of RAM that Windows will allow Java to be allocated (even with special switches in the Java control panel). Is there a version of Linux that does not impose these limits, so I can accomplish this task without Java running out of memory?
Four answers:
Silent
2012-06-12 16:24:05 UTC
Could you explain a bit more about what you're trying to do and exactly what limits you think Windows is enforcing? It would be especially useful to know why your program is using a large amount of memory.



In Windows, the per-process address space limit for a 32-bit process is 2 GB. With Large Address Aware enabled on the executable, it increases to 3 GB (or 4 GB on 64-bit Windows). For a 64-bit process, the address space limit is 8 TB on x64 processors and 7 TB on Itanium processors.



If your program is actually using more than that, it's very likely that it can and should be re-architected to use less memory. This may be the only solution if you're using a 32-bit operating system, since it's impossible for such systems to even have more than 4 GB of memory.
Ratchetr
2012-06-12 16:59:55 UTC
A 32 bit JVM is going to be limited to a maximum of 2G on Windows and Linux. In practice, the limit is lower than that, because the JVM requires a contiguous address space for the heap, and some of the 2G space will be used, and possibly fragmented by other things besides the heap. I've read that Windows might give you 1.2 to 1.4 maximum. Linux maybe 1.6 (Those numbers come from a quick Google of the subject, not extensive testing or personal experience).



With a 64 bit JVM on a 64 bit OS, the 2G limit goes away, and the upper bound is probably going to be limited by the maximum size of the swap file.



I just tried running java -Xmx6g and it didn't fail. I allocated a 1g array, and that worked. I allocated a 2g array and it slowed my machine to a crawl for a couple minutes, but it did work. I only have 4g of physical, and a number of programs running (including XP running under VMWare). I'm not surprised it crawled. I'm surprised it worked.



But I have to agree with Silent. Just out of curiosity, what are you doing? There certainly are problems that require these large amounts of memory, but they are a pretty tiny subset of problems. Maybe there are better ways of doing what you are trying to do, with less memory? Or maybe not.
straathof
2016-12-12 22:57:21 UTC
The languages delivers you some outfitted-in issues like key words and applications that carry out some predefined initiatives. You improve a application applying this prebuilts. This prebuilts are defined via the language developer interior the laptop language bits and bytes. whenever you run a application that's compiled (in case of C,C++) or interpreted then compiled (in case of Java). This step makes particular of no syntatical errors contained in this methodology and produces a compiled code (.obj report (C,C++) or byte code (Java)). This compiled code is now completed i.e., instructions are accomplished as pronounced. This skill of compilation is accomplished via compiler. The compiler is a device, which interprets intense-point language to device-point and vice-versa. those instructions are given to the processor chips applying ssome command words. The processor chips are additionally programmed. shall we first see how a chip works. each and every processor has a meeting language linked with it. This language instructions are like writing words instead of sequence of bits or bytes. The command words are the sequence of bits whose each and each piece or team of bits defines a particular function. The processor recieves the command word reads each and each piece and produces the needed output contained in this form of sequence of bits and sends to the questioning device. actually this processor chip works with the voltages; 0 bit representing decrease volt or 0 volts and one million-bit representing greater voltage or any useful voltage (relies upon on the chip). On recieving the end result from the chip, the compiler converts it into the needed form and provides the output on the demonstrate screen. i attempted to describe with my finished skill, desire it is going to sparkling your doubts.
Brandon
2012-06-12 16:21:10 UTC
use Ubuntu and start your program like this :

java -Xmx1024M -Xms512M -cp yourprogram.jar



make sure to replace the min and max memory to whatever you need.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...