EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB485859: Troubleshooting errors in Java code type OutOfMemoryError.


Ramses Castro Cabrera

Senior Cloud Support Engineer II • MicroStrategy


MicroStrategy software makes use of Java processes that will eventually throw an Out of Memory runtime exception, a clear indicator that your memory resources have been exhausted. In this case, we need to distinguish between a normal memory exhaustion and a leak. Analyzing the OOM’s message and try to find the cause based on the error description.

Symptom


When performing different actions in MSTR, an error like this listed may be displayed:
java.lang.OutOfMemoryError: Java heap space 
java.lang.OutOfMemoryError: PermGen space 
java.lang.OutOfMemoryError: Requested array size exceeds VM limit 
java.lang.OutOfMemoryError: request <size> bytes for <reason>. Out of swap space? 
java.lang.OutOfMemoryError: <reason> <stack trace> (Native method)
 

Cause


The principal cause of this errors is a Memory Leak in Java code. In Java, a memory leak occurs when object references that are no longer needed are unnecessarily maintained.
A memory leak is an OutOfMemoryError (OOM). But not all OOMs necessarily imply memory leaks: an OOM can occur due to the generation of many local variables or other such events. On the other hand, not all memory leaks necessarily manifest themselves as OOMs, especially in the case of desktop applications or client applications. 
The OOM is a common indication of a memory leak. Essentially, the error is thrown when there’s insufficient space to allocate a new object. Thus, an error emerges, along with a stack trace. The first step in diagnosing the OOM is to determine what the error means.
 

Action


Depending on the error displayed the origin an action to be followed may change.
“Java heap space” is an error message that doesn’t necessarily imply a memory leak, mostly it is a configuration issue. It is necessary to adjust the JVM’s memory parameters. We met this kind of leak on Tomcat's configuration. Another potential source of these “Java heap space” OOMs arises with the use of finalizers. If a class has a finalize method, then objects of that type do not have their space reclaimed at garbage collection time. Instead, after garbage collection, the objects are queued for finalization, which occurs later.
You can be able to modify the heap size for:
 

  • 64-bit machine: navigating to HKEY_LOCAL_MACHINE\Software\Wow6432Node\Strategy\JNI Bridge 64\Configuration\JVM Options\HeapMaxSize
  • 32-bit machine, navigate to HKEY_LOCAL_MACHINE\Software\Strategy\JNI Bridge\Configuration\JVM Options\HeapMaxSize

Please review the KB6446 to know more about this configuration.
“PermGen space” This error message indicates that the permanent generation is full. The permanent generation is the area of the heap that stores class and method objects. If an application loads a large number of classes, then the size of the permanent generation might need to be increased using the -XX:MaxPermSize option. Please review the KB325279 for knowing more about this configuration. 
“Requested array size exceeds VM limit” This error indicates that the application attempted to allocate an array that is larger than the heap size. For example, if an application attempts to allocate an array of 512MB but the maximum heap size is 256MB, then an OOM will be thrown with this error message. In most cases, the problem is either a configuration issue or a bug that results when an application attempts to allocate a massive array.
It is possible anyway to modify the heap size in HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Strategy\JNI Bridge\Config for DataServices\32-bit JVM for Windows. And for Linux HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Strategy\JNI Bridge\Config for DataServices\64-bit JVM
“Request <size> bytes for <reason>. Out of swap space” This message appears to be an OOM. However, the HotSpot VM throws this apparent exception when an allocation from the native heap fails, and the native heap might be close to exhaustion. Included in the message are the size (in bytes) of the request that failed and the reason for the memory request. The <reason> is the name of the source module that’s reporting an allocation failure. In some cases, the problem might not even be related to the application. For example, you might see this error if: 
 

  • The operating system is configured with insufficient swap space.
  • Another process on the system is consuming all available memory resources. 
  • The application failed due to a native leak (for example, if some bit of application or library code is continuously allocating memory but fails to release it to the operating system).

<reason> <stack trace> (Native method) If you see this error message and the top frame of your stack trace is a native method, then that native method has encountered an allocation failure. The difference between this message and the previous is that the allocation failure was detected in a JNI or native method rather than in Java VM code.
 


Comment

0 comments

Details

Knowledge Article

Published:

December 16, 2022

Last Updated:

December 16, 2022