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







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 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!


Ignore my previous comment, I'm fine now.
0 7 years, 1 week ago
... this Java thing says something about a "license agreement". I do not wish to accept the agreement, and am unaware if refusing to accept and proceeding to download only for raising stencyl's memory limit is, well, legal. Can somebody explain the details to me so I know if I can proceed or not?
0 7 years, 2 weeks ago
This still doesnt work!! Someone please help because this is for a school assginment :(
0 7 years, 3 weeks ago
when I try to replace file it says access denied.... wad up with that?

0 7 years, 4 weeks ago
Hey everyone, I am working on a Mac running OSX (10.10.5) and I am having trouble raising the memory limit. I can open the package contents and find the line of code as described above, but I cannot edit it at all. The game I am working on is pretty large, so I really need to raise this limit. Any ideas?
1 7 years, 3 months ago
Thanks for the source code! This is very simple guys to do for anyone who is still trying to figure out how to execute this:

1. Download the Java Installation as mentioned in the post.
2. Install the application.
3. Select the memory you want to add for the Stencyl (2GB, 4GB, 6GB, 8GB) - Select something half of your current memory as recommended.
4. This will make a new Pop Up window appear.
5. Select and Copy the source code provided, either by clicking on the web or CTRL C command.
6. Open up "NotePad" or any text editor of your choice.
7. Copy and Paste the Source Code you choose previously from the Stencyl site.
8. Save the File and rename it as "Stencyl.bat".
9. While saving change "Save as type below" from (*.txt) to (all files). This is important because if you dont change the file won't become a (.bat) extension.
10. Navigate through your folder structure on your PC to find Stencyl. In my case C:\Program Files (x86)\Stencyl
11. Copy and Paste the "Stecyl.bat" you created from your "Notepad" this will replace the original Stencyl executable for the one you want.
12. Double Click this file inside Stencyl folder to run it.
13. Enjoy creating games with decent memory XD.

Hope it helps!

2 7 years, 6 months ago
Ok - I kept running the batch file and it kept not starting, so I downloaded the 2GB version even though my PC is 4GB - didn't quite work so I changed the part another member mentioned, changing the number in -Xms64m to be 128. I also had to make sure to save the file in the "all" category (I imagine a .bat file extension would do the same thing) because it kept saving as a notepad doc and not working. Now it's running without the memory message - we will see how well it does.
0 7 years, 7 months ago
As far as finding the directory guys, do a search on your computer or just locate the program in the start menu (On a PC, not a Mac) and right click; select "open file location" and then pay attention to the file path at top. It probably says something like "My Computer - Programs(86) - Stencyl" etc. Double-clicking "Stencyl" gets you into the installation folder.

A handy trick, now that you've double-clicked on "Stencyl" to open that folder, is to download the file to your desktop or somewhere it's easy to find and then drag and drop it into the file location you already opened.

These instructions got the 90% message to go away but there's another message right behind it about Java memory. Still trying to sort that one out; having trouble since it's Windows 10.

0 7 years, 7 months ago
Would you be able to fix this by simply exporting and deleting the games you are finished programming?
1 7 years, 7 months ago
Mad Bomber
I think a more detailed set of instructions would help a lot of us. I have no clue what an installation directory is.
0 7 years, 9 months ago

Sign In to Comment