Kayaman wrote:Indeed, but an extra step is needed. As you say a test should be performed, to figure out what a reasonable expectation in memory usage is going to be which will likely also involve some guess work. Then put the findings in system requirements that are attached to the software as a disclaimer.
You still use -Xmx. You just set it to a reasonable level, if the defaults aren't good enough.
Technical wrote:Actually the server VM scales the maximum heap space according to available resources if you don't provide settings yourself. So you could achieve it if you provide a script to run the stuff that forces the server VM to be used.
haha ok then I'll accept that as my answer.
I thought that might be the case but I was hoping there might be another solution. I know the software will be used on hardware ranging from 4 to 24gb of RAM so it would have been nice to utilise those extra resources and make the software more scalable without the user having to launch the program from the console with -Xmx because I know it could improve performance and reduce the number of file read/writes carried out.
Technical wrote:Well, for one you can do
I like the sounds of that alot! I'll check it out and try it.
How would I change the chunks dynamically? Is there some way of retrieving the max heap within the applicaion?
I assume you mean you determine the max heap size and then from knowing roughly how much you can do per mb of memory determine how much each chunk should be?
to see a bit about the available memory for your application.
Runtime.getRuntime().freeMemory(); // also totalMemory() and maxMemory()