Menu

#44 JVM variable -Xmx size

open
nobody
None
5
2007-04-21
2007-04-21
Anonymous
No

People have requested similar things in the past but I want to take these one step further.

Our application loads massive textures on machines which have memory between 512MB - 4GB. The more memory the application can have, the higher quality the textures it can use (which is critical for its visualisation aspect). A custom batch file detects the machine's RAM at run time and allocates 90% of it to the JVM. This guarantees that we will get the best visual output from each machine running the software. JSmooth can only set a fixed size Xmx which is no good for what we do. Creating different executables just to support potential machine configurations or supplying parameters to the executable are not viable options as we would still need to have a batch file to detect which file/parameters to use at runtime.

I want to be able to define the following parameter values within JSmooth:

percentageOfRAM
fixedRAMSize
minimumRAM
maximumRAM

When the generated executable runs on a machine with sizeOfRAM physical memory, the JSmooth loader should scan the machine's memory and allocate this much Xmx memory to the JVM:

allocated = percentageOfRAM * sizeOfRAM + fixedRAMSize
allocated = Math.min(allocated, maximumRAM)
allocated = Math.max(allocated, minimumRAM)

For defining fixed JVM memory sizes (which is what JSmooth currently does), you simply need to set percentageOfRAM = 0 and allocate your choice to fixedRAMSize.

Thanks
Thomas

Discussion


Log in to post a comment.