How to make the operating system give java more memory?

I have a problem with java jar files and memory.

I use netbeans 6.7 to develop an application, and this application requires more memory to run because it converts other files. Whenever this application converts a 6-10 mb file, it crashes. So I installed netbeans VM Options: -Xms32m -Xmx256m, and the application can easily convert 6-10mb files.

I clean and build the project so that it can create the jar file of my application. I run the jar on my computer and use jconsole to monitor the memory. The maximum memory for using the application is 256 MB. But whenever I transfer it to some other computers, it displays 65-66 mb on jconsole, and the application will crash when converting 6-10 mb files. Therefore, I need to use the command line: java -jar -Xmx256m myjar.jar to execute the jar with maximum memory

Why can this happen, on my computer the maximum memory shows 256 MB, but on another computer 65-66 mb? Can I get another computer to provide maximum memory for my application?

Thanks for your reply. I apologize for my inadequate English. If you all find my question is hard to understand, please let me know.

Regards

Danny

ps: fyi on the computer that I used to develop the application, there are 2 GB of bar, on other computers that I tested, there are 1-2 GB of RAM.

+3
source share
4 answers

You answered your question. The application must be launched using the -Xmx option.

+5
source

, : set _JAVA_OPTIONS = -Xms64m -Xmx128m . : java -Xms64m -Xmx128m . .

. , , . , .

+2

IIRC, VM 64- . -Xmx , , .

0

" " , IDE NetBeans.

0

Source: https://habr.com/ru/post/1745396/


All Articles