changing jvm heap size - jgrasp

*爱你&永不变心* 提交于 2019-12-23 05:17:14

问题


I know how to increase java heap size on command line using flag -Xmx, I need to run my program in jgrasp, how do I increase the heap size for my program in that IDE?

System.out.println("---->"+Runtime.getRuntime().maxMemory());

prints ---->66650112

on adding flag -Xmx256m

the heap size still print the same number


回答1:


Even when you pass -Xmx256m, it doesn't mean that the JVM is going to allocate that amount right away. -Xmx specifies the max heap. The JVM will wait to allocate more heap up until that limit as it sees fit. If you want to specify the min heap and make sure you reach the limit right away, use -Xms256m.




回答2:


For increasing the memory of IDE itself, you will have to add those arguments to jgrasp_portable.bat or winconfig_portable.bat

However from your question it seems, you want to add memory to program running inside the IDE. For that, right click on project in jgrasp IDE, go to Compiler settings - this will open a small popup window in which choose compiler tab. There you have subtabs, choose "Flags/Args/Main", here you can add JVM heap sizes. As suggest in previous answer if you need more memory right on startup, it's better to mark -Xms and -Xmx both in appropriate size. Hope this helps



来源:https://stackoverflow.com/questions/8332370/changing-jvm-heap-size-jgrasp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!