Adventures with Java and Windows memory

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
taustinoc
Dragon
Posts: 518
Joined: Mon Aug 03, 2015 6:30 pm

Adventures with Java and Windows memory

Post by taustinoc »

This may have been documented before, but I don't see it. (Might say more about my search-fu than anything else, but perhaps this will be another opportunity for people to figure this out in the future.)

I have been experimenting with Maptools for a while, with great frustration.

The issue was that when I created a map with a fairly large background map, my remote player didn't get the background map, only the dreaded red X. It wasn't rocket science to figure out that it was a memory issue, but figuring out exactly what the issue was, was an adventure.

It is a combination of a bad choice in how Windows handles memory, a bad choice in how Java handles memory, and an easily misunderstood (but correct) decision in the use of the launcher.

The first issue is that when you tell Java how much memory to use, it has to have a contiguous block of memory. Java crashes otherwise. The second issue, and this only applies to Windows - other operating systems handle memory differently, is that no matter how much physical RAM you have, or how much is free memory you have, Windows can only allocate, at most, about 1.6 GB of contiguous memory, even on 64 bit machines. (Or so it seems, from my research. If you have a different experience, I'd like to hear it.)

The confusing thing was the launcher, interacting with those two things. I checked available memory, and set the max memory to 4 GB. And when I hit the launch button, nothing happened. And because the default setting is no command line box, there was no error message to figure it out. But I figured, hey, the launcher remembers the setting from one use to the next, so it's saved it in a config file somewhere, so I should be able to just launch the MapTool jar file, right? (Yeah, I'm an idiot sometimes.) So it launched with the default 256 MB of memory, which caused the red X.

Once I figured all that out, I did some experimenting, first with 1.5GB max memory, which mostly worked, then 1GB, which worked very reliably on all computers.

So the key lessons are:

Always use the launcher to start MapTool, or create a .bat file to do so.

And, if you're using Windows, never set the max memory to more than 1.6GB.

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Adventures with Java and Windows memory

Post by aliasmask »

You got everything right except for 64bit systems. I recommend setting max mem to 2048, BUT you do have to have the 64bit version of java which is only available via manual download. Min memory should be left alone and the stack should be increased to 3 from the default.

taustinoc
Dragon
Posts: 518
Joined: Mon Aug 03, 2015 6:30 pm

Re: Adventures with Java and Windows memory

Post by taustinoc »

aliasmask wrote:You got everything right except for 64bit systems.
Yeah, I figured that out experimenting after I hit submit. Apparently, not everything you read on the internet is true. :(
aliasmask wrote: I recommend setting max mem to 2048,
Yeah, 2048 is more than 32 bit will handle. 1024 is the most reliable for me.
aliasmask wrote:BUT you do have to have the 64bit version of java which is only available via manual download.
Which also makes no sense, but Java has a number of . . . issues.
aliasmask wrote:Min memory should be left alone and the stack should be increased to 3 from the default.
Noted.

We used Roll20 for today's game, and it works OK. But everybody noticed that the interface was clumsy in some ways, and a two minute demo of MapTool made it clear it's the superior tool for the players. (More complicated for the gamemaster, but that doesn't bother me in the least.)

User avatar
lmarkus001
Great Wyrm
Posts: 1867
Joined: Sat Mar 29, 2008 12:30 am
Location: Layfayette Hill, PA

Re: Adventures with Java and Windows memory

Post by lmarkus001 »

On 32-bit Java, I can comfortably set my max to 1200MB, and usually can get to 1400MB.
On 64-bit Java, I can go big (but limited to available ram, so 4000MB on an 8GB system is reliably available).

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Adventures with Java and Windows memory

Post by Full Bleed »

lmarkus001 wrote:On 32-bit Java, I can comfortably set my max to 1200MB, and usually can get to 1400MB.
The problem here is the memory spike MT has when saving/loading campaign files (which can easily be 20% higher than what you're current usage is). You don't really want to hit the high 1500-1600 range on 32 bit Java. I personally think 1280 is pretty safe.
On 64-bit Java, I can go big (but limited to available ram, so 4000MB on an 8GB system is reliably available).
Exactly.

Why Java still defaults to 32 bit installs is beyond me.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Adventures with Java and Windows memory

Post by aliasmask »

On my old 2 gig system, XP 32bit system I ran 1400, stack 2 reliably. When I switched to 64bit, I needed to bump the stack to 3.

Post Reply

Return to “MapTool”