Possible Memory Leak in Java application


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Possible Memory Leak in Java application

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Posts
    2

    Possible Memory Leak in Java application

    Good Morning! How is everyone out there in the world of Java doing today?

    I did some research yesterday and found out that I might just have a memory leak in new code and/or existing code in the application that I am working on. I am noticing severe memory increases and CPU utilization going to 100% while running the application. I realize that Java does its own garbage collection, but I must be having a problem with memory and CPU time being gobbled up somewhere. I don't believe that it is in the Netbeans 4.0 IDE as the severity of this problem did not crop up until this week after adding even more code to the application. By the way, I am using a Pentium 4 processor with 512 MB of RAM. Netbeans really flies, but my application now does not, unfortunately for this possible memory leak issue. If you could please afford me any information, links, how to solve a memory leak problem, with steps to get rid of it/them. Even if you feel that this is not a memory leak problem and that it is something else entirely different, your suggestions would be greatly appreciated by me! Thank you very much for all of your time and support!

    Eric.
    esi-eric

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    Its hard to tell without seeing the code.... But I've experienced things that have looked
    like memory leaks: I made an applet that was supposed to show random font
    messages on the screen. I coded it on a win2000 machine and it worked fine. Then I
    tried it on a unix machine and it just frose. The reason was that I created a new font
    object each time I painted the screen (and there was a lot of painting going on). The
    win2000 java vm managed to reuse/dispose of (I am not sure) old font objects but the
    unix java vm kept creating new font object all the time and it eventually bogged down
    the system.
    Later I fixed the code, storing the font object in a hashtable for reuse and unix was happy.

    I suspect that your problem may be of this 'flavour'.
    eschew obfuscation

  3. #3
    Join Date
    Jan 2005
    Posts
    2

    Smile Possible Memory Leak in Application

    Thank you so very much for your great reply. It has helped me in solving my initial problem and that being that I don't find the problem to be a memory leak at all. The problem with absorbing 100% of the CPU power when running under peak conditions can be attributed to the tight loop (i.e. 100 ms applet to servlet and servlet back to applet) within the IDE of Netbeans. My current goal now is to get the application going on Tomcat without the Netbeans and Tomcat Server (in Netbeans) in the loop so as to take away some of the extensive memory and CPU overhead caused by Netbeans 4.0. I have also been informed that Netbeans draws alot of CPU overhead as well as memory from the system as it potentially has memory leaks of its own as well. So, on to battle getting Tomcat working outside of the IDE. I am having problems, but eventually they will be solved. If you have any suggestions about Tomcat as a standalone server running a web application, I would be pleased to hear about them. Because, for some reason When I run my application, the tomcat server finds the servlet, but it can't seem to instantiate it. The java console gives a 404 error (not found error) but this really implies that the servlet just can't be used because it could not be instantiated. Any insights on this would be great! Thank you very much for your time and consideration of my issue!!!!! And, for the great answering of my post!

    Eric.
    esi-eric

  4. #4
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    Sorry Eric, its been nearly 3 years since I worked w. tomcat and all I remember is
    that getting into the nuts&bolts of the server configuration was complicated....

    I'm using Apache but I guess that does not cover your system's requirements.
    eschew obfuscation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center