简体   繁体   English

VisualVM - 查找对类的所有引用

[英]VisualVM - Find all references to a class

I am attempting to debug a permgen error in an application. 我试图在应用程序中调试permgen错误。 I am running VisualVM to profile the app and have taken a heapdump of the memory snapshot. 我正在运行VisualVM来分析应用程序,并采取了内存快照的堆转换。

Loading the snapshot into VisualVM for analysis, I can currently see in the classes list several classes appearing several times, all listed with 0 instances, 0 size - I am only expecting one of these classes each (probably linked to its classloader) - Is there any way to determine what is still holding references to these classes with no instances? 将快照加载到VisualVM中进行分析,我现在可以在类列表中看到几个出现多次的类,都列出了0个实例,0个大小 - 我只期望每个类中的一个(可能链接到它的类加载器) - 是否存在有什么方法可以确定什么仍然保持对没有实例的这些类的引用? Happy to use another tool if I can just load in the dump(.hprof) to analyze what is holding the reference. 很高兴使用另一个工具,如果我可以加载转储(.hprof)来分析持有引用的内容。

Thanks! 谢谢!

Well, saying "use MAT" doesn't really answer the question! 好吧,说“使用MAT”并没有真正回答这个问题!

To do it in VisualVM, in the Sampler or Profiler view there is a button (top right) labeled "Heap Dump". 要在VisualVM中,在Sampler或Profiler视图中,有一个标记为“Heap Dump”的按钮(右上角)。 Click this, which opens the heap analyser. 单击此按钮,打开堆分析器。 Under the "Classes" tab, all loaded classes are shown. 在“类”选项卡下,显示所有已加载的类。 At the bottom there is a search box, type the class name you are interested in, in the filtered view double click the class in question. 在底部有一个搜索框,键入您感兴趣的类名,在过滤后的视图中双击相关的类。

This opens the instances view. 这将打开实例视图。 Right-click an instance int the left pane, and select "Show Nearest GC Root" to find what is referencing the object. 右键单击左窗格中的实例,然后选择“显示最近的GC根”以查找引用该对象的内容。

Barney 巴尼

I use MAT for stuff like this. 我使用MAT这样的东西。 Works great, even on large heaps. 工作得很好,即使在大堆上也是如此。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VisualVM:如何找到堆中对象的大小,包括它从其字段中引用的所有对象? - VisualVM: how to find size of object in heap including all the objects it references from its fields? eclipse - 仅在特定类和该类的所有子类中查找引用 - eclipse - find references only in specific class and all subclasses of that class Java:如何查找对特定类实例的所有引用 - Java: how to find all references to a specific class instance Java IDE - 查找函数或类的所有INDIRECT用法/引用? - Java IDE - find all INDIRECT usages/references of a function or class? IBM Process Designer - 查找所有 Java 类引用 - IBM Process Designer - find all Java class references 如何通过查看visualVM中的内存分析器结果来查找罪魁祸首类/对象 - How to find culprit class/object by looking at memory profiler result in visualVM VisualVM OQL:查找对两个对象ID具有(间接)可达性/引用的对象? - VisualVM OQL: find object that has (indirect) reachables/references to two object IDs? 在VisualVM中探查单个类 - Probe a single class in VisualVM 将对类的所有引用替换为其对接口的引用 - Replace all references to a class with references to its interface 如何找到对Java类的所有引用(即,依赖关系,传入耦合)? - How do I find all references (i.e., dependencies, afferent couplings) to a Java class?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM