[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Slow Memory Leaks - Plz help Objects and HeyHey

Posted on 2005-04-22
20
Medium Priority
?
211 Views
Last Modified: 2010-03-31
Hi Experts,

I have a huge webapplication which sits on WLS. It relies on xml objects, webservices, ejbs etc (core J2EE). Now, when I run the application for few days, the heap slowly grows and throws OutOfMemory exception.

I tried using OptimizeIt 6.0 and figured out a couple of memory leaks. They are fixed. But still I find some growth in the heap. Is there any better tool used by you guyz for figuring out such problems?...I tried JProbe and YourKit as well. They don't seem to detect slow memory leaks.

I understand the pain in detecting slow memory leaks. Because one has to wait all the time to just reproduce it. Are there any suggestions from you folks?..Any pointers would be of great help.

-Rajesh
0
Comment
Question by:rajesh_bala
  • 7
  • 4
  • 3
  • +2
18 Comments
 
LVL 16

Accepted Solution

by:
suprapto45 earned 336 total points
ID: 13848027
Hi Rajesh,

If I were you, I will not use any tools but I will try to look over at the codes and try to check where the heaps are growing. It may be that you forget to close your connection to DB, or you have some Collections that are containing large data but you have not set them into null.

Maybe, you try to look in which module the heap is growing extensively. Then, you need to do something on that modules. I know that it is very painful to do so but I just have no other solution. I do not know any tools that can help you but I think that to solve it, you need to fix the Java codes itself.

Regards
Dave
0
 
LVL 15

Assisted Solution

by:aozarov
aozarov earned 332 total points
ID: 13848137
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 13848225
Hi aozarov,

Nice meeting you. It seems that I am just a small Java programmer to you :). How many years have you been involved in Java? Haha just curios :).

Regards
Dave
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 10

Author Comment

by:rajesh_bala
ID: 13848322
Hi Dave,
I have been programming for the past 5-7 years...:)..yeah..To fix the earlier memory leaks, I had to look at the code..:)..But if there are 2000-5000 classes along with some other classes like xml parsers etc, you really can't rely on code reading. Thatz why I rely on tools to nail down to the methods and classes and then start looking at those specific classes.

I have quite a bit of experience in finding memory leaks in my earlier projects. But since this is a very slow memory leak, it becomes difficult. So just wanted to know if the experts here have encountered similar problems or not.

-Rajesh
0
 
LVL 10

Author Comment

by:rajesh_bala
ID: 13848327
Hi aozarov,

Thankx for the links. I have already tried the first link. Let me check on the second link. thankx for your links once again.

-Rajesh
0
 
LVL 10

Author Comment

by:rajesh_bala
ID: 13848338
Unfortunately the first link is not meant for Java.

-Rajesh.B
0
 
LVL 15

Expert Comment

by:aozarov
ID: 13848366
>> Unfortunately the first link is not meant for Java.
" trace to resolve memory problems in C/C++ applications and object growth in Java."
Did you read their fact sheets? http://www.ocsystems.com/pdf/RootCause_factsheet.pdf
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 13848377
Hi Rajesh,

Yes, if there 2000-5000 classes, it is killing to search it one by one. Okay, I am listening to thread then :).

Regards
Dave
0
 
LVL 15

Expert Comment

by:aozarov
ID: 13848419
>> It may be that you forget to close your connection to DB,
Though programatically it is very important to close any resources in a finally block in that case
most application server will detect when a connection is not returned to the pool at the end of the transaction and will give some warning.

In order to expedite the debugging process you can try to decrease the memory size and increase the load.
0
 
LVL 10

Author Comment

by:rajesh_bala
ID: 13848422
http://www.codeproject.com/debug/Memory_leak_finder.asp

Sorry about that..I meant this..First one, I have already tried.

-Rajesh.B
0
 
LVL 10

Author Comment

by:rajesh_bala
ID: 13848426
Thanks for the comment aozarov. I am doing that ..I have reduced my heap from 1024Mb to -Xms256m -Xmx256m.

Also, there is no leak in database connections. I have verified that. Its mainly to do with the java code other than JDBC.

-Rajesh.B
0
 
LVL 23

Assisted Solution

by:cmalakar
cmalakar earned 332 total points
ID: 13848820
Hi Rajesh,

        Have u used JRockit Memory Leak Detector provided in WLS. Have a look at the following link:

http://e-docs.bea.com/wljrockit/docs142/userguide/memleak.html

Also note that if the deployed beans idle time out descriptor has been specified or not in the deployement descriptor.

-cmalakar
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13848837
>>Objects and HeyHey

The latter hasn't been around for a long time ;-)
0
 
LVL 23

Expert Comment

by:cmalakar
ID: 13848839
You can also have a look at the cache descriptors given in deployment descriptors
0
 
LVL 10

Author Comment

by:rajesh_bala
ID: 13848899
Hi cmalakar,
That was a good thought. I had used JRA also. In JDK 1.4.2 version of it, it had "MemoryLeak Detector" which you can view using Management console. In JDK 1.5, they expose those using MBeans and the management console is different. You would be able to view the obejcts etc, but not the memoryleak detector kinda thing.

To add to the complexity of the problem, I am using JDK 1.5 classes..:(..But  tried doing JRA as well.

- Rajesh.B


Hi CEHJ,

I didn't mean anything wrong..I joinned this group on 2000 and at that time, HeyHey was of great help. Not sure whether he is busy these days or not..:)..Your posts are very interesting too..Its been a while since I entered this great forum now. Can you please give your thoughts on this problem also?..It would be of great help.

-Rajesh.B
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13848903
Not much i can add of use unfortunately as i haven't any experience of using any profiler ;-)
0
 
LVL 10

Author Comment

by:rajesh_bala
ID: 14533409
Sorry for the delay in posting the update. Atlast I managed to figure out the leaks using OptimizeIt 6. And things are moving fine now. I am not sure how to split the points and give it. Any suggestions would be appreciated.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month18 days, 10 hours left to enroll

834 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