Stencyl 3.4.0 is now out. Get it now!

90% memory error

I am getting the infamous "90% memory usage" warning and crash. I have tried the usual steps to remedy this issue (download the new x64-bit version of Java and the .bat file, and put them in the Stencyl install folder). It should be noted that Stencyl works fine on startup, but i get the error every time, without fail, when I open my "player actor" actor editor. This actor (currently the only actor) has quite a few animations. this is what I believe is bugging out the Java environment. I know someone is going to post http://www.stencyl.com/help/view/ninety-percent-warning/ this link. I can assure you that the steps to raise the memory cap on a windows computer have failed me for the last five times I have tried it. Stencyl never has crashed on startup from the files (and file switches) though. There has been no visible effect no matter what files I put in the install folder (unless I delete something important [and not directly related to the steps on the webpage], so it's the right folder). Are there any other solutions out there to raise the memory? Or have I been doing something wrong with the usual steps?

JeffreyDriver

  • Posts: 1297
Did you see this note on the page?

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.

Yeah. I didn't actually have _JAVA_OPTIONS or anything similar in my environment settings. I have an HP Omen laptop, so if I have the  _JAVA_OPTIONS environment variable, then it should be there, right?

hrm, okay. I'm supposed to use the .bat file to run Stencyl now, right? And if it doesn't run I picked one too high. I have 8GB of RAM, and none of the scripts launched (I tried them all except the 8GB one).

JeffreyDriver

  • Posts: 1297
Quote
Yeah. I didn't actually have _JAVA_OPTIONS or anything similar in my environment settings. I have an HP Omen laptop, so if I have the  _JAVA_OPTIONS environment variable, then it should be there, right?

I don't use Windows, so I'm not sure about that.

Quote
hrm, okay. I'm supposed to use the .bat file to run Stencyl now, right? And if it doesn't run I picked one too high. I have 8GB of RAM, and none of the scripts launched (I tried them all except the 8GB one).

Are the .bat files in the right place?

As far as I know yes. they are in the stencyl install folder (the folder that everything was put in when stencyl was installed).

Here is what the folder looks like. The highlighted files are the downloads that I added (There are two files that I deleted that the downloads replaced).

I think i'm going to uninstall/ reinstall stencyl and try again.

Okay, so upon resetting everything, It seems that stencyl works fine (minus the 90% memory error right off the bat) with 1GB. But as soon as I up it to two+, it crashes immediately.

Another interesting thing is if I put the _JAVA_OPTIONS environment variable back into my system, and set it to the default limit of 512M, then it works (but extremely poorly). If I set the limit to 1024M (1GB) then it works exactly as normal (as if I didn't change anything. 90% error still applies as normal). The interesting thing is that the override limit will allow stencyl to run even if I set the .bat file to use more than 1GB (usually causes Stencyl to crash), or even if I set the .bat file to use 100GB of RAM (far exceeding the limit of my computer. This is because i'm setting the limit, so whatever the .bat  file  can use doesn't really matter). But if I set the _JAVA_OPTIONS limit to anything above 1GB the .bat file crashes. All in all, I think Stencyl thinks I only have 1GB of RAM available even though I have 8. :{

Also the Java 8 was in a .Tar.gz file. which is a compressed .Tar file, so I didn't apparently have the new Java runtime environment installed, just a compressed file with all the files in it. So I downloaded the "Java 8 64bit (offline)" because it's an .exe file, rather than a .Tar.gz.  After getting the runtime environment installed... nothing changed. so... I'm kinda at a loss now of where to go next.

iii

  • *
  • Posts: 183
(Looking at the Capture1.PNG you attached)
Erm.... You supposed to install that Java (JRE), not just put it in the Stencyl folder....
That's not how it works.

I got a feeling your PC is using a 32bit Java (JRE), that is currently already installed in your laptop.
You need the 64bit version.

Download the latest "Windows x64 Offline" version (2nd from the bottom) :
http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
(You can uninstall the current one in your PC from the Control Panel)
After you download from the link above, double click it, and install it.

Then, right click the "Stencyl.bat" file, and select "edit" (this will open Notepad).
Change the bold part like below.

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

The first bold part "java^", this will use the JRE installed in your PC.
If you leave this untouched, it will use the Java in the Stencyl folder instead, located in "..\Stencyl\runtimes\jre-win\"

You can increase the second bold part, 4096 (4GB Ram) above if you need more.
Since you have 8GB, do not go more than 6GB (6144), leave some to your Operating System.
Save the file.
And launch the .bat file.
Hope this helps.

Side Note :
You can just safely remove the _JAVA_OPTIONS environment variable.
Otherwise the method above will not work.

Yes! that was the issue. the .bat file was still looking in the Stencyl folder. Additionally
Also the Java 8 was in a .Tar.gz file. which is a compressed .Tar file, so I didn't apparently have the new Java runtime environment installed...
That was me realizing I didn't actually install anything. I did think it was rather strange no install wizard popped up when the Java runtime finished downloading. (and even stranger when my computer couldn't figure out how to open a .gz file.) I'm all sorted now.
Thank you!