asyard
asyard

Reputation: 1743

what causes memory leak in java

I have a web application deployed in Oracle iPlanet web server 7. Website is used actively in Internet.

After deploying, heap size is growing and after 2 or 3 weeks, OutOfMemory error is thrown.

So I began to use profiling tool. I am not familiar with heap dump. All I noticed that char[], hashmap and String objects occupy too much at heap. How can I notice what causes memory leak from heap dump? My assumptations about my memory leak;

Do you have an idea about them or can you add another assumptions about memory leak?

Upvotes: 0

Views: 952

Answers (2)

Nikem
Nikem

Reputation: 5786

There is one more thing you can try: new project, Plumbr, which aims to find memory leaks in java applications. It is in beta stage, but should be stable enough to give it a try.

As a side node, Strings and char[] are almost always on top of the profilers' data. This rarely means any real problem.

Upvotes: 1

trutheality
trutheality

Reputation: 23465

Since Java has garbage collection a "memory leak" would usually be the result of you keeping references to some objects when they shouldn't be kept alive. You might be able to see just from the age of the objects which ones are potentially old and being kept around when they shouldn't.

  • log4j shouldn't cause any problems.
  • The hashmap should be okay, since you actually want to keep these values around.
  • Inactive sessions might be the problem if they're stored in memory and if something keeps references to them.

Upvotes: 1

Related Questions