How to Suppress the 90% Memory Usage Warnings

Jon

  • *
  • Posts: 17517
TLDR

We've got an official article for this now.

http://www.stencyl.com/help/viewArticle/137/


=================

Why does this message show up?

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 fails to launch.

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.


Get The Alternate Launchers

The following attachments are versions of our executable that allocated a higher amount of memory (2 GB), which is enough for most purposes. Replace the one in your Stencyl folder. That's it!

Windows (If 2GB doesn't work, try the 1 GB version)
2 GB Launcher
1 GB Launcher

Linux
2 GB Launcher

Mac (unzip the .app from it)
2 GB Launcher


Need more than 2 GB? (Windows)

1) Download a 64-bit version of the Java 6 JRE. Install it.
http://www.oldapps.com/java.php?old_java=11929?download

2) Using a text editor, create a batch script (save a text file with a .bat extension) with the following contents. Tweak the paths as needed.


Code: [Select]
cd c:\Program Files (x86)\Stencyl\
"C:\Program Files\Java\jre6\bin\java" -Xms64m -Xmx4096m -jar sw.jar

3) You can place the batch script anywhere. Double-click it to launch Stencyl.

« Last Edit: October 13, 2015, 12:32:07 pm by Jon »

bernard

  • Posts: 120
Haven't tried the Mac version but the Windows EXE does not work. On my computer. dbl clicking it has no effect. Nothing happens.

Jon

  • *
  • Posts: 17517
OK, I'll pull that. I don't have access to Windows at the moment and was pulling a version a team member generated for me. The other two should work, though.

Jon

  • *
  • Posts: 17517
One quickie - how much RAM is on your windows comp? This won't work if you have 2 GB RAM or less.

RibShark

  • Posts: 15
EXE does work for me. Put it back.

bernard

  • Posts: 120
One quickie - how much RAM is on your windows comp? This won't work if you have 2 GB RAM or less.

I am on Windows XP SP3 and have 4 gigs of ram so 2 gigs allocated should be nothing. I allocate 2 gigs for VM's all the time no problem.

And I ran the EXE thru my debugger and it always Exits without starting Stencyl. Haven't figured out why as yet.

The app for the MAC does work as shown by the attached image. The memory for iStencyl is now significantly increased and I am able to load a large game with no memory complaint from iStencyl. The image shows the old app memory at the top and the new .app memory at the bottom.

« Last Edit: December 18, 2011, 02:23:17 am by bernard »

captaincomic

  • *
  • Posts: 6109
Thanks for that. The linux version works.

Jon

  • *
  • Posts: 17517
I've reinstated the EXE for now. Team hasn't gotten back to me yet on it, but I'll take your word that it works.

The memory allocation error is based on current available memory, not total memory you have. (Maybe not?) I've attached a 1 GB variant for those who have trouble with the 2 GB one.

I'd love as much as anyone to be able to set the value as high as we'd want, but I'm fairly sure that that makes it fail to launch at all.

« Last Edit: December 18, 2011, 11:53:17 pm by Jon »

Jon

  • *
  • Posts: 17517
I did some experimenting, and the rule of thumb seems to be this.

- For most Java setups, you can't exceed 2 GB, even if you have way more free RAM than that.
- You can't exceed the physical RAM you have.
- It doesn't appear that your current free memory matters, after all.

If these are the rules we can go by, then I can get a bit creative and address this pretty cleanly using the following:

- Default to 512 MB like today.
- Add a preferences entry for this with these choices
 
512 MB (default), 768 MB, 1 GB, 1.5 GB, 2 GB (maximum)

- If your computer has less than any of those choices, we don't show those options.
- If StencylWorks fails to launch, we need a way to reset it from outside. Hmm...
- If you hit the 90% error, recommend to the user to raise the memory limit if they're less than the max possible.

bernard

  • Posts: 120
Tried both files.

The 1GB works fine and Resource Monitor shows 1GB(almost)

The other one (2GB?) does not work on XP even though I have 4 gigs of memory.

Since the EXE is just a loader which starts SW.JAR with options, maybe you can post a batch file with the command line passed to Java, highlighting the memory allocation so that I can test that and see why 2 GB does not work?

Your idea of a config file is also noteworthy and useful.

Jon

  • *
  • Posts: 17517
You can crib the linux version and rename it to .bat, and I think that will work if you remove the first line and perhaps the ./ in the paths.

bernard

  • Posts: 120
Actually I checked what the parameters were on Google and created a Batch file

Code: [Select]
java -Xms64m -Xmx1396m -Djava.library.path=lib -jar sw.jar
Unfortunately on my 32 Bit XP even though I have 4 Gigs of memory I can only make it a max of 1396 gigs. Even making it -Xmx1397m gives me error:

could not reserve space for object heap
could not create the java virtual machine

Anyway 1396 is better than 512 so I now use that batch file to avoid those memory errors.

Jon

  • *
  • Posts: 17517
I'll look into build this in to the 2.0 installers, using the following rules.

- The field will be an editable dropdown - so you've got the pre-defined choices and the ability to enter your own.

- On Mac, the default will now be 1 GB since Apple doesn't hasn't sold a Mac with less than 2 GB for years. This will still run fine for Mac users with 1 GB.

- I'll never allow a choice higher than 2 GB or the amount of physical RAM you have.

- On XP, I'm going to cap the pre-defined choices at 1.25 GB, which seems to be roughly that 1396 value. You're free to enter in your own exact value if you'd like.

- We have to somehow detect the case of setting it too high and then the app crashes because of that and can't be loaded back in - not sure how to detect this though, but once we know how, we can just set the memory back down to the default.

mikbob

  • Posts: 493
One quickie - how much RAM is on your windows comp? This won't work if you have 2 GB RAM or less.

I am on Windows XP SP3 and have 4 gigs of ram so 2 gigs allocated should be nothing. I allocate 2 gigs for VM's all the time no problem.

And I ran the EXE thru my debugger and it always Exits without starting Stencyl. Haven't figured out why as yet.

The app for the MAC does work as shown by the attached image. The memory for iStencyl is now significantly increased and I am able to load a large game with no memory complaint from iStencyl. The image shows the old app memory at the top and the new .app memory at the bottom.
It hasn't reserved that yet, but the limit is 2gb

Visit Our Site!  http://www.mikbobgames.com
Play The Platforms 2!  http://bit.ly/theplatforms2
Check out our twitter!  www.twitter.com/mikbobgames

Rhys

  • Posts: 1046
I run stencylworks with a 4GB EXE. Not sure why it wouldn't work.