This site requires JavaScript, please enable it in your browser!
Greenfoot back
ImFerocious
ImFerocious wrote ...

2011/8/11

Allocating memory?

ImFerocious ImFerocious

2011/8/11

#
I'm making a mining game known as "Project Condor" (temporary name) link-http://greenfootgallery.org/scenarios/3319 When I'm programming i come across a problem that is kinda time consuming when i try to test just one little change in the code. Every time i compile the scenario in rapid succession i would keep getting an error message saying:
java.lang.OutOfMemoryError: Java heap space
I remember reading faintly that this is caused when the memory allocated to java becomes well full. and i wanted to know how to exactly increase the amount of memory java has access to so that it won't constantly become full. I tried looking at solutions and i found out that: java -Xms64m -Xmx256 (then program name) would do something like add a minimum of 64 megs and a max of 256 megs of memory to that programs available memory and i wanted to know how to make more memory in java available to Greenfoot so i can stop having "java heap space" error
nccb nccb

2011/8/11

#
There is a Java bug that can cause this problem. Some more details with various suggested fixes is available on the bug description. It sounds like upgrading to JDK 7 may avoid the problem, and may be easier than fiddling with the JVM flags.
supermagicmilk supermagicmilk

2011/8/12

#
Go to Greenfoot/lib/ where you should find a file called greenfoot.defs. Open it in a text editor and scroll to the bottom where you should see this line: bluej.vm.args=-Xincgc -Dapple.awt.graphics.UseQuartz=true Add the options to the end here and it should help (like so): bluej.vm.args=-Xincgc -Dapple.awt.graphics.UseQuartz=true -Xms1024M -Xmx1024M I set mine to 1024M because I've got a lot of memory on my computer, but you should set it to something appropriate for your own machine. It doesn't remove the problem, but it makes it come up less frequently.
You need to login to post a reply.