Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Why do I get an error "java.lang.OutOfmemoryError :Java heap space" in CaliberRM SDK?

Why do I get an error "java.lang.OutOfmemoryError :Java heap space" in CaliberRM SDK?

Problem:

Why do I get an error "java.lang.OutOfmemoryError :Java heap space" in CaliberRM SDK?

Resolution:


  • Product Name: CaliberRM
  • Product Version: 2005 R2 SP1
  • Product Component: SDK
  • Platform/OS Version: All


This is due to a known SDK COM problem and the Dot Net garbage collection. Normally to make sure we don?t receive the above error we would set the maximum memory flag of the Java Virtual Machine (JVM) so as the Java Heap Space would not run out of memory. See sample code below:

Dim objStJavaVMInfo As IStJavaVMInfo

" Get the current VM from the initializer...

Set objStJavaVMInfo = objInitializer.JavaConfiguration.CurrentJavaVM

" Set the max memory flag to 1000 MB...

objStJavaVMInfo.Options = "-Xmx1000M"

Unfortunately this code does not set the memory flag

As a workaround in Visual Basic.Net you would normally make an object equal to ?Nothing? to dereference it. The garbage collection system will then free up memory referenced to by this object. To do this use the code Obj = Nothing. Unfortunately this is not the case, when referencing the COM objects in .NET automatically wraps those references in something called RCW (Runtime Callable Wrapper). "UNMANAGED" objects are dealt with within the "MANAGED" .NET environment through the RCW. To make sure that the RCW objects are released we need to call the method

Marshal.ReleaseComObject(Obj)

This method is part of the "System.Runtime.InteropServices"

Calling this method will dereference the object and allow the garbage collection system to free up memory:

my_req = my_session.getRequirement(id_number)

System.Runtime.InteropServices.Marshal.ReleaseComObject(my_req)

my_req = Nothing


Old KB# 15876

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 18:26
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.