更改jvm堆大小-jgrasp [英] changing jvm heap size - jgrasp
问题描述
我知道如何使用标志-Xmx在命令行上增加Java堆大小,我需要在jgrasp中运行程序,如何在该IDE中为我的程序增加堆大小?
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());
System.out.println("---->"+Runtime.getRuntime().maxMemory());
打印----> 66650112
prints ---->66650112
添加标志-Xmx256m
on adding flag -Xmx256m
堆大小仍显示相同的数字
the heap size still print the same number
推荐答案
即使您通过-Xmx256m
,也并不意味着JVM会立即分配该数量. -Xmx
指定 max 堆. JVM将等待分配更多的堆,直到它认为合适为止.如果要指定 min 堆并确保立即达到限制,请使用-Xms256m
.
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
.
这篇关于更改jvm堆大小-jgrasp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!