When users try to run big queries in Oracle Discoverer, they receive an ‘Out of memory’ error. In the Java console you will see an error:
‘Exception occurred during event dispatching: java.lang.OutOfMemoryError: Java heap space’.
These errors are very clear and such an error indicates the application does not have enough memory assigned even if your machine has loads of memory. By default Java assigns 64 MB. Therefore you have to increase the assigned memory.
First you have to figure out which Java Runtime the application is using. In my case it’s Oracle Jinitiator version 18.104.22.168 which has it’s own Java environment. Or you are just using the regular Sun Java Runtime Environment, the standard edition which can be freely downloaded. Below you will find the methods to adjust memory size for either Java or Jinitiator.
Adjusting memory size Java
1. Navigate to your control panel and start the Java control panel or start C:\Program Files (x86)\Java\jre6\bin\javacpl.exe (64-bit) or C:\Program Files\Java\jre6\bin\javacpl.exe (32-bit).
2. Click on the tab Java and fill in the the desired memory values at start parameters, such as -Xms256M –Xmx1024M.
Xms = initial heap size (memory size at start of the application)
Xmx = maximum heap size (maximum memory size the application can use)
3. Click OK twice.
4. The settings are stored in ‘%userprofile%\AppData\LocalLow\Sun\Java\Deployment\deployment.properties’. If you want to push this settings to all of your users, you could use user Group Policy preferences to replace the file in the user directory with the new settings.
Adjusting memory size Jinitiator
1. Start C:\Windows\SysWOW64\plugincpl13122.cpl (64-bit) or C:\Windows\system32\plugincpl13122.cpl (32-bit) or navigate to your Control Panel and start it from there.
2. In the tab Basic at Java Runtime Parameters, fill in the desired values like the image below:
Xms = initial heap size
Xmx = maximum heap size
I discovered the maximum heap size cannot be set at 1024M, this will crash the application. So I used 768M, which also must be enough memory space.
3. Click Apply.
4. Settings are stored in a file ‘properties13122’. It can be found in the folder ‘.jinit’ in the home folder or user profile of the user. If you want to push this settings to all of your users, you could use user Group Policy preferences to replace the file in the user directory with the new settings.
Put it to the test to check if the new memory settings are effective. Try to run a big query which generated the ‘out of memory’ error before. You may have to try this a few times. If there are no errors anymore, it will spare you a lot of complaints and users will be thankful (or just thinking you’re doing your work).