/** * this factory method creates {@link Heap} from a memory dump file in Hprof format. * <br> * <b>This implementation is using temporary disk files for building auxiliary indexes</b> * <br> * Speed: slow * @param heapDump file which contains memory dump * @return implementation of {@link Heap} corresponding to the memory dump * passed in heapDump parameter * @throws java.io.FileNotFoundException if heapDump file does not exist * @throws java.io.IOException if I/O error occurred while accessing heapDump file */ public static Heap createHeap(File heapDump) throws FileNotFoundException, IOException { return createHeap(heapDump, 0); }
public static boolean canBeMemMapped(File heapDump) { if (isGZIP(heapDump)) { return false; callCleaner(mb);
/** * Fast {@link Heap} implementation is optimized for batch processing of dump. * Unlike normal {@link Heap} it doesn't create/use any temporary files. * * @param bufferSize if file can be mapped to memory no buffer would be used, overwise limits memory used for buffering */ public static Heap createFastHeap(File heapDump, long bufferSize) throws FileNotFoundException, IOException { return new FastHprofHeap(createBuffer(heapDump, bufferSize), 0); }
private static HprofByteBuffer createBuffer(File heapDump, long bufferSize) throws IOException { try { if (isGZIP(heapDump)) { return createCompressedHprofBuffer(heapDump, bufferSize); } } catch(NoClassDefFoundError e) { // GZip parser is not available } HprofByteBuffer bb = HeapFactory.createHprofByteBuffer(heapDump, bufferSize); return bb; }
private static Method getMethod(Class<?> c, String method) { for(Method m: c.getDeclaredMethods()) { if (m.getName().equals(method)) { return m; } } if (c.getSuperclass() != null) { return getMethod(c.getSuperclass(), method); } return null; }
public static HprofByteBuffer newFileBuffer(File file) throws IOException { return HeapFactory.createHprofByteBuffer(file, HeapFactory.DEFAULT_BUFFER); }
/** * Fast {@link Heap} implementation is optimized for batch processing of dump. * Unlike normal {@link Heap} it doesn't create/use any temporary files. */ public static Heap createFastHeap(File heapDump) throws FileNotFoundException, IOException { return createFastHeap(heapDump, DEFAULT_BUFFER); }
private static HprofByteBuffer createBuffer(File heapDump, long bufferSize) throws IOException { try { if (isGZIP(heapDump)) { return createCompressedHprofBuffer(heapDump, bufferSize); } } catch(NoClassDefFoundError e) { // GZip parser is not available } HprofByteBuffer bb = HeapFactory.createHprofByteBuffer(heapDump, bufferSize); return bb; }
private static Object rcall(Object o, String method, Object... args) { try { Class<?> c = o.getClass(); Method m = getMethod(c, method); m.setAccessible(true); return m.invoke(o, args); } catch (SecurityException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e.getTargetException()); } }
HprofHeap(File dumpFile, int seg) throws FileNotFoundException, IOException { dumpBuffer = HeapFactory.createHprofByteBuffer(dumpFile, HeapFactory.DEFAULT_BUFFER); segment = seg; fillTagBounds(dumpBuffer.getHeaderSize()); heapDumpSegment = computeHeapDumpStart(); if (heapDumpSegment != null) { fillHeapTagBounds(); } idToOffsetMap = initIdMap(); nearestGCRoot = new NearestGCRoot(this); }
/** * Fast {@link Heap} implementation is optimized for batch processing of dump. * Unlike normal {@link Heap} it doesn't create/use any temporary files. */ public static Heap createFastHeap(File heapDump) throws FileNotFoundException, IOException { return createFastHeap(heapDump, DEFAULT_BUFFER); }
/** * this factory method creates {@link Heap} from a memory dump file in Hprof format. * <br> * Speed: slow * @param heapDump file which contains memory dump * @return implementation of {@link Heap} corresponding to the memory dump * passed in heapDump parameter * @throws java.io.FileNotFoundException if heapDump file does not exist * @throws java.io.IOException if I/O error occurred while accessing heapDump file */ public static Heap createHeap(File heapDump) throws FileNotFoundException, IOException { return createHeap(heapDump, 0); }
public static boolean canBeMemMapped(File heapDump) { if (isGZIP(heapDump)) { return false; callCleaner(mb);
private static Method getMethod(Class<?> c, String method) { for(Method m: c.getDeclaredMethods()) { if (m.getName().equals(method)) { return m; } } if (c.getSuperclass() != null) { return getMethod(c.getSuperclass(), method); } return null; }
/** * this factory method creates {@link Heap} from a memory dump file in Hprof format. * If the memory dump file contains more than one dump, parameter segment is used to * select particular dump. * <br> * <b>This implementation is using temporary disk files for building auxiliary indexes</b> * <br> * Speed: slow * @return implementation of {@link Heap} corresponding to the memory dump * passed in heapDump parameter * @param segment select corresponding dump from multi-dump file * @param heapDump file which contains memory dump * @throws java.io.FileNotFoundException if heapDump file does not exist * @throws java.io.IOException if I/O error occurred while accessing heapDump file */ public static Heap createHeap(File heapDump, int segment) throws FileNotFoundException, IOException { return new HprofHeap(createBuffer(heapDump, DEFAULT_BUFFER), segment); }
public static HprofByteBuffer newFileBuffer(File file) throws IOException { return HeapFactory.createHprofByteBuffer(file, HeapFactory.DEFAULT_BUFFER); }
/** * this factory method creates {@link Heap} from a memory dump file in Hprof format. * <br> * <b>This implementation is using temporary disk files for building auxiliary indexes</b> * <br> * Speed: slow * @param heapDump file which contains memory dump * @return implementation of {@link Heap} corresponding to the memory dump * passed in heapDump parameter * @throws java.io.FileNotFoundException if heapDump file does not exist * @throws java.io.IOException if I/O error occurred while accessing heapDump file */ public static Heap createHeap(File heapDump) throws FileNotFoundException, IOException { return createHeap(heapDump, 0); }
private static Object rcall(Object o, String method, Object... args) { try { Class<?> c = o.getClass(); Method m = getMethod(c, method); m.setAccessible(true); return m.invoke(o, args); } catch (SecurityException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e.getTargetException()); } }