The 90% Memory Warning

by captaincomic (Updated on 2015-03-13)

Why does this happen?

Java operates by allocating a chunk of memory for the application to use before the app launches - it can't be set at runtime.

There is an upper limit to this memory. If you go too high, the application stops operating properly.

So why not just set the limit very high? It causes weaker machines with less memory to fail to open the app at all.

Although we are working to reduce memory usage and plug leaks, there are large games for which having the higher memory usage will be useful.

Common Misconception: The 90% memory warning has nothing to do with how much RAM your computer has. You could have 128 GB of RAM and still hit this since Java's upper cap sits around 4 GB and on some systems, may be as low as 2 GB.


How to Safely Suppress This Warning (Windows)

First, if you don't have a 64-bit Java installed already, get the latest 64-bit version from Oracle.

Then make a batch script with the following contents, changing the 1024 to something bigger until it works for you. To make the script create a text file, save it with a .bat extension, and stick it in the Stencyl directory. If you don't have permissions to create it within the Stencyl directory, you have to create it in your user directory and move it to the Stencyl directory afterwards.

java -Xms64m -Xmx1024m -jar sw.jar

Double click the script to start Stencyl from now on.

Note: The -Xmx setting may be overridden by the _JAVA_OPTIONS environment variable. See this tutorial for how to delete the variable.


How to Safely Suppress This Warning (Linux)

1) Edit the Stencyl shell script.

2) Change the thing that looks like "-Xmx1024m" to a higher number - the 1024 represents MB.


How to Safely Suppress This Warning (Mac)

1) Right-click the Stencyl.app bundle and "Show Package Contents".

2) Edit Contents/MacOS/Stencyl.

3) Find the line that starts with -Xmx1536m and change the number to a higher number - the 1536 represents MB.


Disclaimer: All articles are geared towards Stencyl 3.0 and above. Use comments to provide feedback and point out issues with the article (typo, wrong info, etc.). If you're seeking help for your game, please ask a question on the forums. Thanks!


Okay, to change it to a batch file on Windows, for me, I had to capitalize .BAT for it to be recognized as a batch file. That might help somebody out.

However, I don't know where to put this file...what exactly is the directory?

0 1 day, 18 hours ago
I DON"T KNOW WHERE THE STENCYL DIRECTORY IS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!
1 3 weeks, 5 days ago
I have tried running Stencyl as administrator:
- adding start.bat with: java -Xms64m -Xmx4096m -jar sw.jar (running the program clicking this file)
- adding start.bat with: java -Xms128m -Xmx4096m -jar sw.jar (running the program clicking this file)
- editing Stencyl.bat setting the values as above

And I've checked that _JAVA_OPTIONS is not the problem...
Maybe it is just not ment to work in WIN 10?

It is only a small start tutorial game that I'm coding!

0 1 month, 1 week ago
Hey guys, there's a complete response here - http://community.stencyl.com/index. php/topic,5601.0.html
0 2 months, 1 week ago
ahem, maybe use JProbe (http://www.javaperformancetuning.c om/tools/jprobe/index.shtml) or similar tool to do some memory profiling?
0 2 months, 2 weeks ago
Did not work for me. The .bat file doesn't do anything, can you give clearer instructions pls.
1 4 months, 1 day ago
ON MAC CHANGE THE FILE TO A TXT: Right click on the file>Get Info>Name and Extension>Add ".txt" (without the quotes)> Press "Add" if message pops up>Double click on file to open> Do the change>Go back to Name and Extension>Delete the ".txt"
0 4 months, 1 week ago
I keep getting this error and its frustrating as a new Stencyl user (especially when I'm on the fence about which game creator software to dig my heels into). I have windows 8 and following captainincomic's explanation I run into the issue of naming the script/text file.

1. What should the text/script file be called? (otherwise I'm not sure how Stencyl/Java knows how to call on this file for use)

Following the directions it seems this should be the file I now use to open Stencyl?...

Also I deleted the environment variable but I still get the 90% memory usage from Stencyl.

0 5 months, 1 week ago
Found out why it wont work, insted of the line -Xms64m use -Xms128m and it will work.
My .bat file:
java -Xms128m -Xmx4096m -jar sw.jar

0 7 months, 3 days ago
how do i edit it (MAC version) it opens in command line.
2 7 months, 2 weeks ago

Sign In to Comment