我已经将堆转储加载到 map 中。我发现带有泄漏对象的散列图。如何获取该 HashMap 中的键字段?我怀疑我在 map 中有同一个对象的多个副本,名称如 joseph_0001、joseph_0002、...、joseph_WXYZ。
到目前为止,我已经尝试过以下语句。
/* 41415459 is the object id. This just gives me back the hashmap */
SELECT * FROM OBJECTS 41415459
/* this gives me the hashmap's internal table */
SELECT o.table FROM OBJECTS 41415459 o
/* this also gives the that hashmap's internal table
but displayed in a prettier way */
SELECT * FROM OBJECTS 122490835
/* this doesn't return anything. i understand it doesn't make
and sense because we're asking for the key of an array which
an array doesn't have but I hope conveys what i'm trying to
achieve */
SELECT o.key.displayName FROM OBJECTS 122490835 o
/*
Problem reported:
Sub-Select must return an object list: SELECT o FROM OBJECTS 122490835 o
*/
SELECT n.key from (SELECT o FROM OBJECTS 122490835 o) n
我想要每个键的 displayName 字段。
请注意 MAT 的 OQL ( http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.mat.ui.help%2Freference%2Foqlsyntax.html ) 规范与 VisualVM 不同。
最佳答案
SELECT OBJECTS keyNode.key FROM OBJECTS ( SELECT OBJECTS table[0:-1] FROM OBJECTS 41415459 ) keyNode
41415459 是您的 map 。 如果您的键是对象并且您需要来自内部的信息,则可以在此基础上进行进一步的选择。 如果数据很多并且您需要进一步处理或获取统计信息等,您可以将数据导出为 CSV。
关于java - 给定一个 hashmap 的对象 id,获取 hashmap 中键的字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41861782/