JVM heap size requirement

I have a module that experiences out of memory issues if users don’t have a JVM heap size set higher than the default. I have arrived at a fairly large allocation compared to the default; something like initial/max of 1024/2048Mb is definitely trouble free.

It didn’t surprise me too much that I needed to increase memory allowance - the module doesn’t have a large map nor high-res graphics but the counters have a lot of traits and a typical save file is now approx 1.5Mb compared with 32Kb for the bare-bones original version. However, what is puzzling me is that the memory issue only seems to kick in when a user attempts to save a game or close a log file.

Is this expected behaviour? What are the guiding metrics that a module developer should be using when suggesting JVM heap size settings ?

Mark

Thus spake marktb1961:

It didn’t surprise me too much that I needed to increase memory
allowance - the module doesn’t have a large map nor high-res graphics
but the counters have a lot of traits and a typical save file is now
approx 1.5Mb compared with 32Kb for the bare-bones original version.
However, what is puzzling me is that the memory issue only seems
to kick in when a user attempts to save a game or close a log file.

Is this expected behaviour?

Yes, it’s because the traits and the way they’re serialized is VERY
bulky.

What are the guiding metrics that a module
developer should be using when suggesting JVM heap size settings ?

Increase the max heap in small increments (say, 256MB at a time) until
you get something which works comfortably.


J.