This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

How To: Find the Memory Leaks In Your Program

 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello advanced Java users!

I'm part of a team of web developers that is developing a servlet/JSP based dynamic website.

We are finding that over time, our JVM becomes hopelessly thrashed and we suspect a memory leak.

Basically the website runs quite fine for about an hour under moderate load, and maybe less time for heavier loads. A server restart every hour (thankfully it only takes 5 seconds), is our Quicker-quick-fix.

But now we are really beginning to wonder how to track down the resource hog.


Does there exist a 'gotcha' list that we could consult along the lines of:
"Have you ever created objects and stuck them into Hashtables, only to find...."
That we can go through and do a 'code review' of our JSP/Servlets ?

At this point, we are not in the position to buy any sort of tools like JProbe or the like. We are mainly looking for 'common mistakes' that can cause a memory leak.

Thanks much.

p.s. - The reason this is not in the Servlet and/or JSP forum, is because I'm sure memory leaks are common to all Java programming paradigms, and not limited to servlet/jsp programming.
[This message has been edited by Mike Curwen (edited December 13, 2001).]
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this presentation will give you a lot of help even you are not going to buy their product
Java Mem leak
Thanks!
Roseanne
Need Java real project experience? Join our project team here!
[This message has been edited by Roseanne Zhang (edited December 13, 2001).]
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike-
My best suggestion is to use a program like JProbe on your project, we've used it many times to track down memory leak problems (coming sometimes from the Web Application, and sometimes from our App Server). One of the major leaks we were experiencing was traced to this bug http://developer.java.sun.com/developer/bugParade/bugs/4414045.html in the JDK.
Nonetheless, I think a program like JProbe could definately be benificial.
------------------
- Jessica Bradley
HP Bluestone
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Several years back I used the free trial version of JProbe to find a leak. I dunno if they still have a free trial.
 
Sheriff
Posts: 6037
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both JProbe and OptimizeIt have free trial versions. I think OptimizeIt was for 2 weeks. With most software, if you need more time, you can usually just ask for another 2 week license.
I say try to use it. You can pick it up in hours. If it solves your problem, and your company can't justify a single license fee, I'd leave. (Think about how many hundreds, if not thousands of dollars are being wasted tracking it down now. Figure a developer costs the company $50-100/hour, so a 1 hour code review of 5 developers costs a couple hundred dollars.)
Aside from that, I'd look into graphics (image files) and threads. Although I'm not sure of the best way to track them down.
--Mark
 
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I managed to get a clue about a memory hog once using -Xprof or -Xrunhprof options of the (Windows) java command. I forget which it was.
 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!