protected Instance getInstance(int index) { return heap.getInstanceByID(dumpBuffer.getID(offset + ((long)index * (long)idSize))); }
public Instance getInstance() { return heap.getInstanceByID(getInstanceId()); }
public List<Instance> getBiggestObjectsByRetainedSize(int number) { long[] ids; List<Instance> bigObjects = new ArrayList<Instance>(number); computeRetainedSize(); ids = idToOffsetMap.getBiggestObjectsByRetainedSize(number); for (int i=0;i<ids.length;i++) { bigObjects.add(getInstanceByID(ids[i])); } return bigObjects; }
private boolean checkReferences(final long refInstanceId, final long instanceId) { Instance instance = heap.getInstanceByID(instanceId); Iterator<FieldValue> fieldIt = instance.getFieldValues().iterator(); while (fieldIt.hasNext()) { Object field = fieldIt.next(); if (field instanceof HprofInstanceObjectValue) { HprofInstanceObjectValue objectValue = (HprofInstanceObjectValue) field; if (objectValue.getInstanceId() == refInstanceId) { return true; } } } return false; }
private void printObjs(List<Long> changedIds, List<Long> oldDomIds, List<Long> newDomIds, List<Boolean> addedByDirtySet, List<Long> changedIdx) { if (changedIds.size()>20) return; TreeMap<Integer,String> m = new TreeMap(); for (int i=0; i<changedIds.size(); i++) { Long iid = changedIds.get(i); Long oldDom = oldDomIds.get(i); Long newDom = newDomIds.get(i); Long index = changedIdx.get(i); Boolean addedByDirt = addedByDirtySet.get(i); Instance ii = heap.getInstanceByID(iid.longValue()); int number = ii.getInstanceNumber(); String text = "Index: "+index+(addedByDirt?" New ":" Old ")+printInstance(iid); text+=" OldDom "+printInstance(oldDom); text+=" NewDom: "+printInstance(newDom); m.put(number,text); } for (Integer in : m.keySet()) { System.out.println(m.get(in)); } }
String printInstance(Long instanceid) { if (instanceid == null || instanceid.longValue() == 0) { return "null"; } Instance ii = heap.getInstanceByID(instanceid.longValue()); return ii.getJavaClass().getName()+"#"+ii.getInstanceNumber(); }
public Instance getInstance() { return classDump.getHprof().getInstanceByID(getInstanceId()); } }
public Instance getClassLoader() { return getHprof().getInstanceByID(getClassLoaderId()); }
public Instance getInstance() { return instance.dumpClass.getHprof().getInstanceByID(getInstanceId()); }
public Instance getDefiningInstance() { return classDump.getHprof().getInstanceByID(classDump.getJavaClassId()); }
private void updateAdditionalIds(final long instanceId, final List<Long> additionalIds) { Instance i = heap.getInstanceByID(instanceId); //System.out.println("Inspecting "+printInstance(instanceIdObj)); if (i != null) { for (Object v : i.getFieldValues()) { if (v instanceof ObjectFieldValue) { Instance val = ((ObjectFieldValue)v).getInstance(); if (val != null) { long idp = val.getInstanceId(); Long idO = new Long(idp); Long idomO = map.get(idO); if (idomO != null && idomO.longValue() != 0) { additionalIds.add(idO); //System.out.println(" Adding "+printInstance(idO)); } } } } } }
public Instance getInstance() { HprofHeap heap = dumpClass.getHprof(); HprofByteBuffer dumpBuffer = heap.dumpBuffer; int idSize = dumpBuffer.getIDSize(); long instanceId = dumpBuffer.getID(instanceArrayOffset + 1 + idSize + 4 + 4 + idSize + ((long)index * (long)idSize)); return heap.getInstanceByID(instanceId); } }
idom = getIdomId(instanceId); for (;idom!=0;idom=getIdomId(idom)) { Instance ip = heap.getInstanceByID(idom); JavaClass cls = ip.getJavaClass();
Instance getNearestGCRootPointer(Instance instance) { if (heap.getGCRoot(instance) != null) { return instance; } computeGCRoots(); long nextGCPathId = heap.idToOffsetMap.get(instance.getInstanceId()).getNearestGCRootPointer(); return heap.getInstanceByID(nextGCPathId); }
break; instance = heap.getInstanceByID(instanceId); if (instance instanceof ObjectArrayInstance) { Iterator<Instance> instanceIt = ((ObjectArrayInstance) instance).getValues().iterator();
synchronized void computeRetainedSizeByClass() { if (retainedSizeByClassComputed) { return; } computeRetainedSize(); long[] offset = new long[] { allInstanceDumpBounds.startOffset }; while (offset[0] < allInstanceDumpBounds.endOffset) { int instanceIdOffset = 0; long start = offset[0]; int tag = readDumpTag(offset); if (tag == INSTANCE_DUMP) { instanceIdOffset = 1; } else if (tag == OBJECT_ARRAY_DUMP) { instanceIdOffset = 1; } else if (tag == PRIMITIVE_ARRAY_DUMP) { instanceIdOffset = 1; } else { continue; } long instanceId = dumpBuffer.getID(start + instanceIdOffset); Instance i = getInstanceByID(instanceId); ClassDump javaClass = (ClassDump) i.getJavaClass(); if (javaClass != null && !domTree.hasInstanceInChain(tag, i)) { javaClass.addSizeForInstance(i); } } // all done, release domTree domTree = null; retainedSizeByClassComputed = true; }
instance = heap.getInstanceByID(instanceId); if (instance instanceof ObjectArrayInstance) { ObjectArrayDump array = (ObjectArrayDump) instance;
long origSize = instanceEntry.getRetainedSize(); if (origSize < 0) origSize = 0; instSize = getInstanceByID(instanceId).getSize(); instanceEntry.setRetainedSize(origSize + instSize);
public List getBiggestObjectsByRetainedSize(int number) { long[] ids; List bigObjects = new ArrayList(number); computeRetainedSize(); ids = idToOffsetMap.getBiggestObjectsByRetainedSize(number); for (int i=0;i<ids.length;i++) { bigObjects.add(getInstanceByID(ids[i])); } return bigObjects; }
Instance getNearestGCRootPointer(Instance instance) { if (heap.getGCRoot(instance) != null) { return instance; } computeGCRoots(); long nextGCPathId = heap.idToOffsetMap.get(instance.getInstanceId()).getNearestGCRootPointer(); return heap.getInstanceByID(nextGCPathId); }