Why does this happen?
The Java runtime reserves a chunk of memory for Stencyl to use before launching -- it can't be raised after the fact. If you exceed this limit, Stencyl locks up.
So why not just set the limit very high? It causes machines with less memory to fail to launch Stencyl at all.
Although we are working to reduce memory usage and plug leaks, there are large games for which having the higher memory usage is useful. This guide explains how you can raise the limit.
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 Raise the Memory Limit (Windows)
-
Install the 64-bit version (x64) of Java 8 to your computer.
-
Download one of the following scripts and place it into your Stencyl installation directory. (For best results, go lower than what you have -- e.g. If you have 4 GB, choose the 2 or 3 GB option.)
- Double-click the script to launch Stencyl from now on.
Note 1: If Stencyl fails to launch, choose a script with a lower amount of memory.
Note 2:Note: The -Xmx setting in the script may be overridden by the _JAVA_OPTIONS environment variable. See this tutorial for how to delete the variable.
How to Raise the Memory Limit (Mac)
-
Right-click the Stencyl.app bundle and pick Show Package Contents.
-
Using a text editor, open up Contents/MacOS/Stencyl.
-
Search for -Xmx1536m and change the number to something higher such as 3072 (which would be 3 GB).
- Save the file, then relaunch Stencyl. (If your Mac complains that the app is "damaged", go to System Preferences > Security and Privacy and allow apps to be downloaded from Anywhere.)
Note: If Stencyl fails to launch after you make an edit, your number is too high. Try something smaller such as 2048.
How to Raise the Memory Limit (Linux)
-
Edit the Stencyl shell script.
- Change the part that looks like -Xmx1024m to a higher number such as 3072 (which would be 3 GB).
Print Article Edit Article How to Edit an ArticleNote: If Stencyl fails to launch after you make an edit, your number is too high. Try something smaller such as 2048 or 3072.
50 Comments
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
I DON"T KNOW WHERE THE STENCYL DIRECTORY IS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!
1
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
Hey guys, there's a complete response here - http://community.stencyl.com/index. php/topic,5601.0.html
0
ahem, maybe use JProbe (http://www.javaperformancetuning.c om/tools/jprobe/index.shtml) or similar tool to do some memory profiling?
0
Did not work for me. The .bat file doesn't do anything, can you give clearer instructions pls.
1
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"
1
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