JVM Maximum Heap Size Problem

Is there a pure Java solution that let us dynamically change the maximum heap size required?

The reason that I am asking is because the GUI program that I wrote works in many situations. The key problem is that the data users load can range from 10MB to 4GB. Most people who uses the GUI application has 512MB to 1GB memory, but we also need to use this program on 64-bit Solaris to visualize some of the high resolution data. We have no way in advance to guess the size of the data users will load.

Currently, I am using a stub main that re-launches the program with fix maximum 800m request. Apparently, this request works in most situations, even on people with 512MB memory. However, the drawback is the long delayed start up time. We also have to tell people trying to load larger data on 64-bit machine the specific commands they need to use to launch the application. Requesting memories larger than 1GB on Windows machine with 2-4GB ram is a matter of trial and error even if JVM reports to have much larger physical rams. The matter is further complicated when the application is launched with in WebStart with full permission since the memory reported is much less than what actually is available.

So the question is, is there a better way to solve this problem?

Thanks

[1310 byte] By [coconut99_99a] at [2007-11-27 0:16:14]
# 1

> Is there a pure Java solution that let us dynamically

> change the maximum heap size required?

No.

Although there might be an RFE somewhere in the database about that.

>

> So the question is, is there a better way to solve

> this problem?

1. Provide an app that reads user file sizes and then estimates needed usage.

2. Provide sufficient documentation that users can set it up themselves.

3. Write your own vm launcher. In terms of licensing this should be easier once java is completely open source. Right now you would have to talk to Sun to distribute.

jschella at 2007-7-11 22:03:52 > top of Java-index,Java HotSpot Virtual Machine,Specifications...