lotk
lotk

Reputation: 394

Memory leak without OutOfMemory exception?

I have a problem with my program (JSF running on Glassfish). It's proceeding a lot of data (and inserting it to the database using hibernate). And the problem is that after about 2 hours of work it slows down. I don't get any exception (especially there is no OutOfMemory). Is it possible that it is a memory leak? I've checked the heap dump with Eclipse Memory Analyzer and there were some HashMap issues. I've repaired it where it was possible and now the tool doesn't show this problem. But my application still doesn't work properly.

Upvotes: 1

Views: 326

Answers (2)

Andreas Dolk
Andreas Dolk

Reputation: 114817

There is a chance, that you have some sort of memory leak and produce a lot of temporary objects so that after a decent time the garbage collector kills your performance. If this is the case, you could play with the -Xmx option: with less heap size your application should slow down earlier, a bigger heap should show an oppisite effect.

The effect could also be caused by growing internal datastructures. Operations on datastructures always have a time complexity ("Big-O-Notation") and if the complexity is polynomal or even worse, such operations can kill performance too. Have a look at those collections in your applications that grow over time and double-check, that you've chose the optimal collection type.

Upvotes: 0

Stephen C
Stephen C

Reputation: 719376

It sounds like your problem is not a conventional memory leak at all.

If I was to guess, I'd say that you've got a poorly designed data structure, an ineffective cache, or maybe a concurrency bottleneck.

You should probably focus on performance profiling to see where the time is going and to look for signs of lock contention.

Upvotes: 3

Related Questions