Results 1 to 7 of 7
  1. #1
    icesnake is offline Member
    Join Date
    Jun 2010
    Posts
    7
    Rep Power
    0

    Default Idle Java Application - Memory Leak? (JCONSOLE)

    Hi, can someone help me. I have a j2ee web application. I want to monitor if it has a memory leak. I have a tomcat server that has only 1 deployed application I want to monitor. I ran the tomcat server last night and then run jconsole to monitor the memory usage of the application. After running the server, I didn't access the application. I left the server and the jconsole overnight in idle mode. This morning I saw that the memory usage of my application increases through time even if it is idle (no one accessing) See image below for the memory chart. I also force Garbage Collection in JConsole on the last part that's why memory went down on the last part of the chart. My question is does the memory chart say I have a memory leak in my application? But if I have a memory leak, why is it that after I perform GC the memory went down to normal. Any explanation or help will be appreciated. THanks


  2. #2
    icesnake is offline Member
    Join Date
    Jun 2010
    Posts
    7
    Rep Power
    0

    Default

    I attached another image below showing same application but I used/accessed the application during some time. In the chart below, I can see that from 1150-1250 I have again increasing memory usage. During this time, I didn't access the application but at 1251 onwards I access the application and the memory went back to normal again. Why is it that only during idle time of my application does the memory increase? Is it a problem in my application or the garbage collector? Thanks.


  3. #3
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,560
    Blog Entries
    7
    Rep Power
    21

    Default

    If your application is hooked up to the (inter)net there will always be some activity (e.g. Google might have visited you). If you don't run out of memory there's nothing to worry about; the garbage collector can handle it. Especially the fact that memory consumption goes back to normal after a while is a good sign ...

    kind regards,

    Jos

  4. #4
    icesnake is offline Member
    Join Date
    Jun 2010
    Posts
    7
    Rep Power
    0

    Default

    Yes, it's connected to the internet. I'll try to test it again without connection but may I ask, is it possible that a memory leak in my application cause this increase in memory usage even if it's in IDLE? I'm testing my application because an outOfMemory Java Heap space error occured in production and I'm now testing if it has a memory leak. I'm first trying to see if it has mem leak in JConsole before using any profiling tool. Any tool or techniques suggestions for memory leak detection will be greatly appreciated. Thanks.

  5. #5
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,560
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by icesnake View Post
    Yes, it's connected to the internet. I'll try to test it again without connection but may I ask, is it possible that a memory leak in my application cause this increase in memory usage even if it's in IDLE? I'm testing my application because an outOfMemory Java Heap space error occured in production and I'm now testing if it has a memory leak. I'm first trying to see if it has mem leak in JConsole before using any profiling tool. Any tool or techniques suggestions for memory leak detection will be greatly appreciated. Thanks.
    Yes it is possible that a memory leak occurs somewhere: think of listeners, still linked to some event producers while they are not needed anymore. You can also try to increase the maximum heap size (type "java -X" and look for the -Xmx flag). But the fact that a simple forced garbage collection brings down the memory use to a previous (lower) level is an indication that there is no leak ...

    kind regards,

    Jos

  6. #6
    icesnake is offline Member
    Join Date
    Jun 2010
    Posts
    7
    Rep Power
    0

    Default

    Hi again, I have tested my application and again monitored its mem usage. Now, I accessed and processed transaction with my application. I processed about 20+ transactions and ran my application for about 5 hours. I think the app has a memory leak somewhere but I can't locate it. I used the YourKit Java Profiler tool to profile my app but I'm new to this and can't seem to find the leak. I don't know if traced the code correctly but I traced it to JAXBUtil and I don't know what to do especially that I didn't right the code for the JAXBUtil. I provided screenshots for the JAXBUtil, I hope someone can help me.. Thanks.








  7. #7
    aryazahra is offline Member
    Join Date
    Jun 2010
    Posts
    7
    Rep Power
    0

    Default

    Quote Originally Posted by icesnake View Post
    Hi again, I have tested my application and again monitored its mem usage. Now, I accessed and processed transaction with my application. I processed about 20+ transactions and ran my application for about 5 hours. I think the app has a memory leak somewhere but I can't locate it. I used the YourKit Java Profiler tool to profile my app but I'm new to this and can't seem to find the leak. I don't know if traced the code correctly but I traced it to JAXBUtil and I don't know what to do especially that I didn't right the code for the JAXBUtil. I provided screenshots for the JAXBUtil, I hope someone can help me.. Thanks.









    hi,thanks alot for your comment,I neead a simple tool to monitor memory buttlenecks in my program,I wrote my program in intellij idea, how should I use a simple tool,please help me.......
    thanks a lot

Similar Threads

  1. Memory Leak questions, code review
    By mensaFool in forum Advanced Java
    Replies: 9
    Last Post: 03-08-2010, 04:27 PM
  2. Out of memory work around for a java application (please help!)
    By javameanslife in forum Advanced Java
    Replies: 9
    Last Post: 02-02-2010, 01:52 PM
  3. Help I have a memory leak...
    By cdman52 in forum Java Applets
    Replies: 10
    Last Post: 09-28-2009, 10:37 PM
  4. java.util.logging.StreamHandler memory leak?
    By toadaly in forum Advanced Java
    Replies: 1
    Last Post: 02-23-2009, 02:46 PM
  5. Memory Leak using a Swing Application Project
    By iimasd in forum AWT / Swing
    Replies: 0
    Last Post: 11-27-2007, 10:20 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •