As of late 2021, we are in the process of updating Stencylpedia and fixing up outdated & broken content. Thanks for your patience!

88,221

Views

Beginner

Level

50

Comments

The 90% Memory Warning

by Jon (Updated on 2015-10-13)


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)

  1. Install the 64-bit version (x64) of Java 8 to your computer.

  2. 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.)

  3. 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)

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

  2. Using a text editor, open up Contents/MacOS/Stencyl.

  3. Search for -Xmx1536m and change the number to something higher such as 3072 (which would be 3 GB).

  4. 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)

  1. Edit the Stencyl shell script.

  2. Change the part that looks like -Xmx1024m to a higher number such as 3072 (which would be 3 GB).

Note: If Stencyl fails to launch after you make an edit, your number is too high. Try something smaller such as 2048 or 3072.

Print Article Edit Article How to Edit an Article
Disclaimer: 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!

50 Comments

Trialdi99
I didn't have any luck with the bat file trick. No matter which I tried it failed at about 1GB of RAM usage.
I have found a solution that works a whole lot better for me. Now I think I run out of VRAM rather than being limited by the jre.
The computer I tried this on only has 4GB of RAM and 256MB of VRAM so I can't say which fails first. Antiquated.
I copied the 64 bit jre folder into the stencyl runtimes folder. I then modified the 4GB .bat file to run from that folder.

Goto c:\Program Files\Java\ and copy the folder "jre 1.8.0_192" (may vary depending on the version you have installed).
Goto c:\Program Files (x86)\Stencyl\runtimes\ and paste it there.
Modify the .bat file or create one (notepad) so that it reads (with your version/folder name):

runtimes\jre1.8.0_192\bin\java^
-Xms64m^
-Xmx4096m^
-XX:CompileCommand=exclude,javax/sw ing/text/GlyphView,getBreakSpot^
-XX:-OmitStackTraceInFastThrow^
-jar sw.jar

It seems the 4GB (-Xmx4096m^) version works best for me.
You probably could get it ro run directly from the 64bit install folder directly but my batch skills have faded so I made it simple for me instead by copying.
Someone is probably going to say it doesn't work and that I should buy a lottery ticket.
I'll show myself out

0 5 years, 11 months ago
Snakedungeon14
Here is a solution to this, watch this Youtube video!

https://youtu.be/r0YUyJtMuOs

0 6 years, 2 months ago
varelochi
This is not working! I tried everything mentioned here and I still get the message. I have 16Gb RAM and tried from the 8gb to the 2gb dile and I’m still getting the message, what’s even worse, I get the one saying the memory ran out and it’s not saving my work. At this point Stencyl is useless! Please give us a solution ASAP!
1 6 years, 11 months ago
Nyarlathlotep
"Search for -Xmx1536m and change the number to something higher such as 3072 (which would be 3 GB)."
How do I change the number?

1 6 years, 11 months ago
AikoCHI
Hello :d
like everybody else here, i need some help.
btw running on a mac.
I tried manny times now to change the number, but it always tells me it's to read Only and can not be saved.
I don't know what to do to change the memory and now stench don't really work right.
I have many times deleted my game and installed stencyl , then downloaded and installed it again.

Awaiting replay, thank you

2 7 years, 1 week ago
BMJ
For people trying to use the files that ShakeTelevision shared -- these are good (it's what works for me), but you need to get rid of the space in the middle of the word "swing". It shouldn't be there and it won't work unless you edit the file to remove that space.
0 7 years, 1 month ago
ShakeTelevision
For those unable to get to the links (2,3,4,6,8Gb for Windows), try the wayback machine instead. Works there...
https://web.archive.org/web/2016091 6085705/http://www.stencyl.com:80/h elp/view/ninety-percent-warning

And just incase, here they are listed below. (Do not include "2Gb", "3Gb", etc in the script, as they are just titles I've added to break them up.) See the links on the wayback machine above. See BMJs comment for what to do with it.

2Gb
java^
-Xms64m^
-Xmx2048m^
-XX:CompileCommand=exclude,javax/sw ing/text/GlyphView,getBreakSpot^
-XX:-OmitStackTraceInFastThrow^
-jar sw.jar

3Gb
java^
-Xms64m^
-Xmx3072m^
-XX:CompileCommand=exclude,javax/sw ing/text/GlyphView,getBreakSpot^
-XX:-OmitStackTraceInFastThrow^
-jar sw.jar

4Gb
java^
-Xms64m^
-Xmx4096m^
-XX:CompileCommand=exclude,javax/sw ing/text/GlyphView,getBreakSpot^
-XX:-OmitStackTraceInFastThrow^
-jar sw.jar

6Gb
java^
-Xms64m^
-Xmx6144m^
-XX:CompileCommand=exclude,javax/sw ing/text/GlyphView,getBreakSpot^
-XX:-OmitStackTraceInFastThrow^
-jar sw.jar

8Gb
java^
-Xms64m^
-Xmx8192m^
-XX:CompileCommand=exclude,javax/sw ing/text/GlyphView,getBreakSpot^
-XX:-OmitStackTraceInFastThrow^
-jar sw.jar

1 7 years, 2 months ago
Anonymous0038
Never mind what I said previously, because I think I might know what to do now, but I have just one problem...I have 1GB...1GB! These scripts aren't going to help anymore are they? Because I tried the lowest of 2GB and it still didn't work.
0 7 years, 5 months ago
Anonymous0038
The links for Windows didn't download anything. It just led me to the code of it. And also, this isn't explained in such a way that can be easily understood. We need some pictures or at least a demonstration video to help guide other people who are having the same problem.
0 7 years, 5 months ago
BMJ
Amendment to my last comment: Instead of copying/pasting, you can also just right-click the link to the batch file and select "Save link as" (it might also be called "Save target as"), but you can't save it directly to the Progam Files (x86) ----> Stencyl folder. Save it somewhere else and move it there. (I don't know why.)
0 7 years, 5 months ago

Sign In to Comment