Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2922
  • Last Modified:

debugging java.lang.OutOfMemoryError

We seem to have a java memory leak in our PL/SQL code somewhere. We must have a newXYZ without a freeXYZ or something because we're getting:

"ORA-29532: Java call terminated by uncaught Java exception: java.lang.OutOfMemoryError."

The problem is in a queue payload processing program. It uses AQ to dequeue an object containing a message type and an XML clob, parses the clob, processes it depending on the payload message type, and optionally creates another XML message for another queue.

I've reviewed the code in detail and have not found the source of the problem. Is there some trick to find out where the memory leak is occurring?
0
rkogelhe
Asked:
rkogelhe
1 Solution
 
Helena Markováprogrammer-analystCommented:
You can search this site
http://asktom.oracle.com
for "java.lang.OutOfMemoryError". Maybe it will help you.
0
 
ypwitkowCommented:
0
 
benpungCommented:
lucy,

i am the one that started the thread you reference in your link. freeing up my parsers and documents helped, but i'm still having the problem. what am i limited by as far as setting my own session memory with the setmaxmemorysize procedure referenced in the link? am i limited by the java_pool_size param? the java_max_session_size param? i cannot seem to get through this parsing process w/o the memroy error. any addional info would help. thanks.

ben
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
rkogelheAuthor Commented:
.
Thanks Lucy, the major problem was that the DOM docs where not freed. It wasn't obvious that they required a free.
.
I take it that in general, all XDK objects must be freed? Why do you think Oracle does not free objects when they loose context?
.
Does this change in 9i2? If not, I still think we need to find a mechanism for finding or spotting memory leaks.
.
Where is the java memory for a user process? I tried looking at the PGA and UGA and it does not seem to be there. Is it in the SGA?
.
Are there any stats (i.e. v$sesstat) that can display its growth?
.
Can oradebug be used to find a leak?
.
I still seem to have a leak of some sort. The process runs in a SNP process and the process's resident memory keeps growing.
.
0
 
rkogelheAuthor Commented:
I still don't see a good solution to this problem. I suspect we still have a memory leak as the SNP processes are consuming more an more memory.

Is there not a standard java class that can be used to diagnose memory problems?
0
 
rkogelheAuthor Commented:
Ok, I found a solution I think:

-- create in SYS

CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED FactoryRuntime AS
import java.lang.*;

public class Runtime {
  public static long freeMemory () {
    long free = Runtime.getRuntime().freeMemory();
    return free;
  }
}
/

show errors java source Runtime

CREATE OR REPLACE FUNCTION freeJavaMemory
  RETURN NUMBER
AS
  LANGUAGE JAVA
    NAME 'FactoryRuntime.freeMemory() return long';

With this, you can log the size of java memory before and after function calls. This is not definitive, because there seems to be some discrepency how much memory is allocated for each call, but you can see when a significant amount of java memory is consumed without being freed.

0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Tackle projects and never again get stuck behind a technical roadblock.
Join Now