Delphi Clinic C++Builder Gate Training & Consultancy Delphi Notes Weblog Dr.Bob's Webshop
Hubert Klein Ikkink (aka Mr.Haki) - Communications Officer
 Mr.Haki's JBuilder Jar #40
See Also: JBuilder Papers

Start applications a bit quicker
We all know Java applications aren't the fastest applications around. It is still a lot slower than a native Windows application for example. And therefore every bit of speed increase we can accomplish is welcome.

When we run a Java application we start up a Java Virtual Machine (JVM) and this JVM executes the Java application. The JVM will reserve a space in memory of about 1Mb (the heap size) for loading the Java application. If during the execution of the Java application, the application needs more memory, he JVM will expand this space in memory up to what is needed.
Especially this last process (expanding memory after initial startup size) takes time. If we can allocate more memory (expand the heap size) when the JVM starts, we notice a slight performance increase because the extra memory doesn't need to be created during the application's execution time: it is already there!

We can include several arguments when starting the JVM and the one we want to use is:

  -ms<number> Set the initial Java heap size
In JBuilder 2 we can go to File | Project properties... and select the Run/Debug tab. Here we can assign Java VM parameters. If we enter -ms5120, we create a initial heap size of 5Mb for our application.


This webpage © 1997-2009 by Bob Swart (aka Dr.Bob - www.drbob42.com). All Rights Reserved.