Vassal 3.2.2 and RAM

I’ve been testing Vassal 3.2.2 a bit under both windows and linux. I notice some performance weirdness.

For the last two years I’ve been using 3.1.x mainly with Ubuntu 10.10.

Under Windows 7, Vassal 3.2.2 apparently uses considerably less RAM. Both the module library and the running module seem more efficient in this regard.

When I run 3.2.2 under Ubuntu, it uses considerably more RAM than 3.1 with the same system configuration. In particular, the module library process uses about twice more RAM than 3.1 (over 100 MB as opposed to about 60 MB with 3.1). However, a friend tested it with some lighter linux environment and it seems about as efficient as with my Windows 7.

I upgraded to Ubuntu 12.10 and optimized my system as much as I could (it was about time to do this anyway). Tried both openjdk7 and the latest version of oracle java. Still the same, small variance at best.

What might be causing this difference in performance? I’m starting to wonder whether my system is configured properly, but I’m not sure what exactly might be wrong.

Thus spake Filip:

Under Windows 7, Vassal 3.2.2 apparently uses considerably less RAM.
Both the module library and the running module seem more efficient in
this regard.

When I run 3.2.2 under Ubuntu, it uses considerably more RAM than 3.1
with the same system configuration. In particular, the module library
process uses about twice more RAM than 3.1 (over 100 MB as opposed to
about 60 MB with 3.1). However, a friend tested it with some lighter
linux environment and it seems about as efficient as with my Windows 7.

Very little changed in the module manager between 3.1 and 3.2. I think
the most likely culprit is something with the JRE.

If you’re starting VASSAL with the provided shell script (VASSAL.sh),
you’ll see that we don’t set any heap sizes. What you’re getting for
memory usage is what the JRE picks for its heap.

When I run the MM, what I see from gnome-system-monitor (and also from
ps—I believe they get their data from the same place) is this: The
JVM the MM is running in has 7.5GB virtual memory mapped, 207MB of which
is resident. I believe the gigantic amount of virtual memory is due to
the JVM setting the max heap to a percentage of your physical memory if
you don’t specify a max heap. (I have 20GB RAM, so this is around 35%.)
This isn’t memory being used, it’s just assigned address space, which is
inexhaustible for all practical purposes on 64-bit machines. The amount
of resident memory I’m seeing is not out of line with what I’ve seen
before for the MM.

If I look at the MM process in jvisualvm, what I see is the used portion
of the heap sawtoothing between (approximately) 15MB and 90MB with a
cycle time of about 10 minutes, so it looks like the JRE is being
extremely lazy about collecting garbage.

What might be causing this difference in performance? I’m starting to
wonder whether my system is configured properly, but I’m not sure what
exactly might be wrong.

I suggest you connect to the MM with jvisualvm to see what heap usage
looks like.


J.

Yes, using jvisualvm, I see roughly double the heap usage with 3.2.2 than with 3.1.20. (Looking at the MODULE’s process memory while a game is running, not the main VASSAL process). It takes MUCH longer to load a module. Poor performance under both OS X and Windows (8). Some modules that would load and play under 3.1.20 will no longer work under 3.2.2. Also, the main VASSAL process now sawtooths in heap usage at a much faster rate than it did before - probably should look into re-using some of those objects.

I’m also beginning to incur some serious memory consumption by Java. As you know, my builds are highly automated but I don’t know if that would cause such an increase.

Yesterday, I was testing a automated process for calculating and determining the results of combat between a player and creature. I was looking for specific results (mainly to see if the creature would run after a segment of combat). When I didn’t get those results, I’d hit UNDO and try again. After about 8 attempts, the system slowed down to stand still. When I was finally able to get the task manager open, it showed that Java was using nearly 2 gigs of memory and any action I took just increased the usage even higher.

I’ve also found that If I start with a JVM Initial heap of 512 and a max of 1 gig, the game runs very slowly and it will crash shortly with less than that with a Out of Memory error . I’ve currently got it set to 2 gigs initial and 3 gigs max and I’m start running into some sluggishness after awhile.

It appears that Java is not releasing unused memory but rather just piling on more stuff.

Windows 7
Vassal 3.2.2
4 gigs ram
Not sure what version of Java offhand (I’m on a different computer right now) but it’s whatever version Vassal 3.2.2 installed as it was the first Vassal installation on that other computer.

I’ve been testing things again today, exclusively on Linux with the current version of Sun Java. Now, the difference in memory usage by module manager is about ~30 MB, and it seems it only occurs after loading a module. Upon closer examination, modules seem about equally inefficient regardless if I load them under 3.1.17 or 3.2.2. As I stress test them by rolling large pools of dice repeatedly or whatever, Vassal keeps eating more and more RAM. However, it didn’t normally cause any issues in our games so far.

JohnyNonsense, which modules specifically refuse to load for you under 3.2.2?

Sorry for the late reply, Filip. It’s a custom module that worked fine under 3.1.20. Same thing happens on a friend’s computer. Sometimes it will give an “Out of memory” error, after a long wait. I’m trying to step though the code to see where it’s hung up, but it’s difficult (haven’t used Java in a while, not accustomed to Eclipse debugger, code not commented). It’s a module with a lot of map windows, most of them fairly small. Total module size around 65MB. If anyone wants to have a look, I’ll be happy to send it.

Thus spake JohnnyNonsense:

Sorry for the late reply, Filip. It’s a custom module that worked fine
under 3.1.20. Same thing happens on a friend’s computer. Sometimes it
will give an “Out of memory” error, after a long wait. I’m trying to
step though the code to see where it’s hung up, but it’s difficult
(haven’t used Java in a while, not accustomed to Eclipse debugger, code
not commented). It’s a module with a lot of map windows, most of them
fairly small. Total module size around 65MB. If anyone wants to have a
look, I’ll be happy to send it.

We can’t troubleshoot if we don’t have the module. If you want any
dev to look at it, you need to make it available for us somewhere.


J.

Thus spake JohnnyNonsense:

Yes, using jvisualvm, I see roughly double the heap usage with 3.2.2
than with 3.1.20. (Looking at the MODULE’s process memory while a game
is running, not the main VASSAL process). It takes MUCH longer to load
a module. Poor performance under both OS X and Windows (8). Some
modules that would load and play under 3.1.20 will no longer work under
3.2.2. Also, the main VASSAL process now sawtooths in heap usage at a
much faster rate than it did before - probably should look into re-using
some of those objects.

Can you tell us which objects you think are being retained?


J.