简体   繁体   中英

I cannot limit Java heap size

I've set java heap size limit with Xmx128m in "idea64.vmoptions" file of Intellij. However, even though I'm allocating gigabytes of memory in my code, the program still works, I don't get any not enough memory error.

What is the explanation of this behaviour.

PS:Intellij reads the file "idea64.vmoptions", I checked it, that is, when I set it to Xmx16m, even the Intellij cannot start.

Thanks

I think, idea64.vmoptions sets the options required for running IntelliJ Idea itself. It does not control the options for running java programs inside IntelliJ.

Check the Edit Configurations of the your respective project type. For example, in configuration of a jar application : VM options box is present to set the java options required to run the jar file. Setting -Xmx128m in this box should work for you.

vm options declared in idea64.vmoptions is only used for intelliJ to lauch. For project specific configurations can be done through Editing "Run"->"Run/Debug COnfigurations" in intelliJ idea.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM