难以定位 Java Profiler 中提到的应用程序中的对象
我正在将 YourKit Java 分析器用于托管在 Weblogic 上的 Web 应用程序。我目前正在调查内存泄漏。探查器显示大约 25 万个 char[] 对象占用了 25% 的内存。
我尝试查看我的应用程序以了解这些 char[] 对象的创建位置。令人惊讶的是,我没有找到任何东西。我在这里做错了什么吗? Weblogic 是在内部创建这些 Array 对象吗?
如何在我的应用程序中找到创建这些对象的确切代码段? 谢谢。
问候, 悉达多
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这些字符数组很可能构成 java.lang.String 的内部部分。您应该要求分析器概述当前内存中的字符串以及是否存在许多重复项。
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 关于 char[] 可能位于字符串中的说法是正确的。我建议使用 FindBugs 对代码进行静态分析。这通常会发现很多好东西。您应该做的其他事情是查看会话对象,因为它们更加持久。
我不了解 YourKit,所以我无法对实际追踪分配源发表评论,抱歉。
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.