Vassal RAM Usage

Greetings. OK 1st up
Lenovo AIO idea center
I5 6200U 2.3GHz
RAM 16GB
Windows home 64bit
Intel HD Graphics 520
Vassal ver 3.3.1
Java 8_241 64bit
Module WiF CE Maps and Units Ver 2_0a.vmod (will provide link if you want, but will need to update the one on Google drive before)

In a nut shell Vassal does not release RAM. The following was observed using windows task manager.

Open vassal
open module (edit mode) RAM circa 410 MB
open a saved game RAM >4GB
run refresh counters RAM >6GB
save and close game RAM still >6GB
Open another saved game RAM >8.4GB
run refresh counters RAM no change
save and close game RAM no change
absent for circa 5 min RAM >7.4GB
open another saved game RAM <8.4GB
performed some editing (mainly taking counters from the “store” and placing them in force pools, etc) RAM <8GB
save and closed game RAM <8GB
closed module RAM 90MB
Reopen module RAM 440MB
reopen the last saved game RAM <4.4GB
RAM dropped to <3.9GB while I busy elsewhere
Done the editing, saved and closed game RAM >4GB
closed module RAM 72MB
Copied module, renamed to ver 2_0b
opened b module and deleted 2 send to traits on the land units (via a prototype)
loaded an a version saved game and refreshed counters. saved as a b game
closed module
opened a version and the a ver saved game RAM <6GB
closed game RAM no change
closed module RAM 204MB
opened b ver and the b version saved game RAM 3GB
closed game RAM >3.3GB
closed module RAM 174MB

Two things are readily apparent. Closing a game but not the module does not release the system RAM used by vassal. Send to commands suck up RAM. I’ve no idea for the former, vassal should just release that RAM.

My hypothesis for the latter is that vassal reserves the RAM for all send tos for each unit/game piece as using a send to command also stores the location of where that game piece came from so the send back command will work. Would it not be a far better use of system resources if the RAM was only used to store the necessary data on activation of the send to command and release that RAM on completion of the sand back command? Just a thought, of course I am likely to wrong anyway. :smiley:

Bit disappointed here. There is/appears to be a real problem with Vassal with its RAM usage: failure to release that RAM back to the system unless it is totally shutdown and the, apparently, reservation of great amounts of RAM for any send to command on game pieces. These issues are design flaws.

To what did you have your max heap set during all of this? I can’t comment on whether the observed behavior is expected without knowing that.

This is a Java application, the RAM usage is beyond our control, the only thing we can influence is the maximum amount of RAM used. And we gave this setting to the users, you probably set the max heap to these high amounts yourself.

Yes, it can be that this maximum amount is used always.

Yes, some Java GCs run much better when they use the max. amount of RAM from the beginning.

You can either limit the maximum heap, or you try messing with the GC settings, we gave you the custom VM options file for this. Google up “Java Garbage Collectors”, read, understand, then apply this knowledge.

  • these are design flaws of the modules, why would a module with some simple 2d graphics need more than 300-500mb RAM?

Thank you very much. Interesting reading. Understanding fully comes later. Now, however, I understand that it is not Vassal, but an inherent function of Java. As I am not a java programmer, nor indeed a programmer of any language, I was obviously unaware of all this. Many (many) years ago I did dabble in machine code programming and used fortran IV at uni (punch cards back then). But I never progressed into full blown programming.

Again thanks for the useful lead into the why java does things.

Thus spake palad0n:

Thank you very much. Interesting reading. Understanding fully comes
later. Now, however, I understand that it is not Vassal, but an inherent
function of Java. As I am not a java programmer, nor indeed a programmer
of any language, I was obviously unaware of all this. Many (many) years
ago I did dabble in machine code programming and used fortran IV at uni
(punch cards back then). But I never progressed into full blown
programming.

Again thanks for the useful lead into the why java does things.

Are you going to answer my question about what your max heap was set
to when you took the measurements in your test case?


J.

8GB

That module seems to run fine for me with the default max heap size of 512MB, actually taking around 750MB of memory.

When you set the max heap size to 8GB, you are telling Java that you are happy for it to use up to 8GB and it will never run the Garbage Collector to release any memory that Vassal releases.

I was about to say oh-we-should-flesh-out-the-help-entry-for-that and I’ve just realized that oddly enough we have no “help” buttons (nor entries) related to the preferences, and so little real guidance for users on what to put in these fields and when good situations are to change them. Hopefully some help buttons won’t be hard to add, though I may need your assistance Brent with doing a good job on some of the entries.

One very good reason to switch to a new programming language in the future; with Java, you have to tell it the maximum memory it can use at startup, and then there’s no way for the system to later say “hey, can you give me some of that 8GB back; I really need it for this other program?” without closing the Java program completely.

This is a non-issue, giving it a max of 0.5-1gb should suffice for 99% of all modules, and should be affordable on most computers of the past decade. In this particular case the user gave it 8GB. If an application needs a certain amount of memory, the users shouldn’t complain when it reserves this memory and makes it unavailable to other applications.

Also, the most successful computer game of all times runs on Java.

Thus spake jrwatts:

One very good reason to switch to a new programming language in the
future; with Java, you have to tell it the maximum memory it can use at
startup, and then there’s no way for the system to later say “hey, can
you give me some of that 8GB back; I really need it for this other
program?” without closing the Java program completely.

What programming language lets other programs reclaim memory from a
different running program, or provides any facility for letting other
programs request that? I know of none.

The issue I see with Java here is that the user can’t possibly know
in advance how much memory will be needed.

The problem you’re facing is an entirely different one: 8GB is far,
far too large for your max heap. Try 512MB, followed by 768MB and 1024MB
if that’s not enough. There are hardly any modules which benefit from
more than that.


J.

We should invent one that allows this.

Also invent companies that take payments for services, but give the money back on request.

“Hey I paid my electricity bill but can I have the money back please, I need it for something different now”

This is what users go on - The map sometime flashes onscreen & then disappears. Other times it never appears at all.
This is a symptom of too little memory being allocated to the VASSAL program.

Vassal 3.1 and later allow you to set the memory for a module using the preferences for that module. Open the preferences and increase the maximum amount of memory. This value should generally be lower than the maximum amount of RAM your system has installed.

For earlier versions: When using Web Start to launch VASSAL, it is allocated 256MB. When running the manual installer, you can select the amount of memory to allocate to VASSAL during installation.

There is no mention of what the JVM actually really means. Thus, big module, give it more RAM. Now that I understand what the JVM is, I’ve reduced JVM max heap to 512 MB. ATM everything appears to work when loading and playing a game.

Conversely, I have, in the past, received out of memory error messages, thus the steady increase to the JVM allocated RAM. Now, from memory only, the out of memory errors do appear to become more common when in edit mode.

I’ll monitor this situation and advise if any issues arise.

I’ve written some documentation for the Preferences screens, so that there will now (from VASSAL 3.5) be a “Help” button on the preference screen that will document things like this.

FWIW, “JVM” stands for “Java Virtual Machine”, which is just a complicated abbreviate-y way of saying “the Java process that is running VASSAL”. But yes, point taken, we needed better docs here :slight_smile:

Brian