3

I create the autorun cd of which contains the dicom images. it taks arround 10-15 min. to display dicomviewer on screen. so, I want to increase the jvm heap size at runtime, programatically,(not from the commandline) suppose i have to allocate 500mb to my app when i start the app. is it possible? i am using windows platform.

jap1968
  • 7,747
  • 1
  • 30
  • 37
soni smit
  • 31
  • 7
  • I've been trying to find an answer for this question for a while now. but I don't think its possible since I didn't find anything... – nafas Mar 10 '15 at 09:57
  • If you dislike the command-line arguments try a Java runner like [launch4j](http://launch4j.sourceforge.net/). There you can specify the max heap size without having to worry about command-line arguments. – Robert Mar 10 '15 at 10:22

3 Answers3

1

Literally, no. The max heap size is set at JVM launch time and cannot be increased.

In practice, you could just set the max heap size to as large as your platform will allow, and let the JVM grow the heap as it needs. There is an obvious risk in doing this; i.e. that your application will use all of the memory and cause the user's machine to grind to a halt. But that risk is implicit in your question.

Darshan Lila
  • 5,772
  • 2
  • 24
  • 34
  • when i autoplay the cd os will create the process and it display in taskmanager,but it takes time to launch.so, is there ant other way to descrease that processing time? – soni smit Mar 10 '15 at 10:17
0

One approach you can take in a Windows environment is to install a service that starts up your application. Via this method you can make the windows service point to a wrapper file that calls all the relvant files to start up your application. Here you can specify something like;

set JAVA_OPTS=-Xrs -Xms6G -Xmx6G -XX:MaxPermSize=384M 

You can use this to specify your JVM memory settings on startup.

Please see http://docs.oracle.com/cd/E19900-01/819-4742/abeik/index.html for more information about the parameters.

Hope this helps,

V

Vect0r
  • 66
  • 1
  • 4
0

Since the problem is about the duration of the pictures display and knowing that you cannot change the heap size programmatically, what about optimizing your program to load the pictures faster ?

You can use multiple threads or asynchronous loading to speedup the display. You may also use paging in the user interface.

Can you edit the code of the user interface ?

Dino
  • 710
  • 1
  • 10
  • 22