?
Solved

debugging java.lang.OutOfMemoryError

Posted on 2003-03-11
6
Medium Priority
?
2,739 Views
Last Modified: 2007-12-19
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
Comment
Question by:rkogelhe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 22

Expert Comment

by:Helena Marková
ID: 8109603
You can search this site
http://asktom.oracle.com
for "java.lang.OutOfMemoryError". Maybe it will help you.
0
 
LVL 2

Accepted Solution

by:
ypwitkow earned 750 total points
ID: 8109609
0
 
LVL 1

Expert Comment

by:benpung
ID: 8113231
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Author Comment

by:rkogelhe
ID: 8118218
.
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
 
LVL 3

Author Comment

by:rkogelhe
ID: 8208908
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
 
LVL 3

Author Comment

by:rkogelhe
ID: 8327461
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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question