Maximum Heap Size reset to Failsafe of 120mb, now unable to

Model Acer Aspire E1-771
OSWindows 8.1
CPU Intel Core i5 323DM 2.6GHz
Memory 4GB
Video Intel HD Graphics 4000
Vassal 3.2.17
Java Version 8 Update 121

I have to admit I have never understood the Max Heap Size nor the way that Vassal seems to very inelegantly (in my view) try to handle it.

I am working on a module where several weeks ago I had to increase the Max Heap Size due to an out of memory message. Having increased the Max Heap Size all was working well and I was able to make further changes to the module.

Today I got another Out of memory message which required me to increase the Max Heap Size which I did, but obviously by too much as there was nothing to indicate how much it should be increased by. Now when I try and open the module I get a message that says that the Max Heap Size set is too large and that the default of 120mb will be used instead and then attempts to start the Module, resulting in an out of memory message that states that the Max Heap Size needs to be increased in preferences, but I cannot do this as I cannot open the module.

So what am I supposed to do now, hopefully the answer is not to start over. I have tried opening earlier back up versions but I get the same message and same problem, ie the Max Heap size set for the module is too large, so it is reset to the failsafe size of 120mb, then unable to open module due to running out of memory and Heap Size needing to be increased.

Is there any way of changing the Max Heap Size without opening the module?

You can edit the preferences file for the module if you can find it. Mine are under Library/Application Support/VASSAL/prefs on MacOS, and under my user AppData\Roaming\Vassal folder on Windows. If you use the run dialog on Windows and enter %APPDATA% it should take you to the right place for the Vassal folder.

Excellent, that works. Many thanks for this I owe you a drink.

Thus spake Robbie:

I have to admit I have never understood the Max Heap Size nor the way
that Vassal seems to very inelegantly (in my view) try to handle it.

It’s a mess forced on us by Java.

The Max Heap Size is the maximum amount of memory that Java will permit
a program to use. It can’t be reset from within a running programm, but
it’s not possible to accurately predict before a module is opened how
much memory it will need. Thus, because the max heap size can’t be
adjusted while a module is open but it needs to be adjustible, we give
the user a way to set it in Preferences.

It’s a silly restriction and it’s one of the reasons Java is a poor
language for applications where the amount of memory required depends
on the data the user provides, and it’s one of the reasons why we will
not be using Java for VASSAL 4.

I am working on a module where several weeks ago I had to increase the
Max Heap Size due to an out of memory message. Having increased the Max
Heap Size all was working well and I was able to make further changes to
the module.

Today I got another Out of memory message which required me to increase
the Max Heap Size which I did, but obviously by too much as there was
nothing to indicate how much it should be increased by.

The reason we provide no guidance here is that if we could guess
accurately, we’d have the Module Manager automatically set the max heap
when launching the Player, in which case there’d be no need for you
to set the max heap to begin with.

Now when I try
and open the module I get a message that says that the Max Heap Size set
is too large and that the default of 120mb will be used instead and then
attempts to start the Module, resulting in an out of memory message that
states that the Max Heap Size needs to be increased in preferences, but
I cannot do this as I cannot open the module.

To what did you set the max heap the previous time? The “too large”
message happens when Java can’t allocate a contiguous block of RAM of
that size. This could be an amount of RAM far, far less than you have
free, due to the requirement (Java’s, not ours) that it be contiguious.

So what am I supposed to do now, hopefully the answer is not to start
over. I have tried opening earlier back up versions but I get the same
message and same problem, ie the Max Heap size set for the module is too
large, so it is reset to the failsafe size of 120mb, then unable to open
module due to running out of memory and Heap Size needing to be
increased.

Are you unable to open Preferences after the Out Of Memory error?


J.

Thanks for explaining this. I now understand why Vassal does not warn when the Max Heap size needs to be increased and why it does what it does.

In answer to your question as to being able to reset the Max Heap size, I got into a loop, because of my ignorance I set the size far too high, then when I tried to open the module it was automatically set to a failsafe size, which was too low for the module I was working on to open and I was being prompted to resize it but could not open the module to do so.

Thaks to the earlier reply I have now been able to set the size in the preferences file for the module.

EDIT - I would add because I did not understand anything about Maximum Heap Size I just increased it by an amount plucked out of the air, I cannot now remember what the amounts were that I set.