0

I am using YourKit Java profiler for my web application which is hosted on Weblogic. I am investigating a memory leak currently. The profiler shows some quarter million char[] objects that are occupying 25% memory.

I tried looking into my application as to where these char[] objects are created. Surprisingly, I didn't find any. Am I doing something wrong here? Is Weblogic internally creating these Array objects?

How do I locate in my application the exact piece of code that is creating these objects? Thanks.

Regards, Siddharth

Sid
  • 4,893
  • 14
  • 55
  • 110

2 Answers2

2

Most probably these character arrays form the internal part of a java.lang.String. You should ask your profiler to give you an overview of the strings that are currently in memory and whether there are many duplicates.

Roland Illig
  • 40,703
  • 10
  • 88
  • 121
  • 1
    remember also, that strings that are constants will never be garbage collected, and so the char[]'s that are part of those Strings will not be eligible either. – MeBigFatGuy Mar 03 '11 at 04:36
  • Oh, I had no idea about it. Thanks. – Sid Mar 07 '11 at 00:44
1

Roland is right on about the char[]s probably being in Strings. I would recommend using FindBugs for a static analysis of your code. This usually finds a lot of good stuff. Something else you should do is look in your session objects since those are more persistent.

I don't know about YourKit so I can't comment on actually tracing down allocation sources, sorry.

Andrew White
  • 52,720
  • 19
  • 113
  • 137