Download Jar. Uses 3874K of libraries. Click here for Pure Java version (5908L/42K).
!7 lib 1400084 // patched heap analyzer import org.gridkit.jvmtool.heapdump.*; import org.netbeans.lib.profiler.heap.*; import java.lang.reflect.Field; static Heap heap; sbool fake = false; p-experiment { File f = stefansOS_heapDumpFile(); print("Loading heap dump (" + toM(fileSize(f)) + " M)..."); heap = HeapFactory.createHeap(f); print("Got heap."); L<JavaClass> classes = heap.getAllClasses(); print("Got " + n2(classes, "class", "classes")); //pnl(sortedIC(mapMethod(classes, 'getName))); L<JavaClass> classLoaderClasses = filter(classes, func(JavaClass c) -> bool { startsWithOneOf(c.getName(), "main$JavaXClassLoader", "x30$JavaXClassLoader") }); print("Got " + n2(classLoaderClasses, "class loader class", "class loader classes")); L<Instance> classLoaders = concatLists(mapMethod('getInstances, classLoaderClasses)); print("Got " + n2(classLoaders, "class loader")); L<Instance> defunctClassLoaders = filter(classLoaders, func(Instance cl) { isTrue(cl.getValueOfField('retired)) }); print("Got " + n2(defunctClassLoaders, "defunct class loader")); print(); if (empty(defunctClassLoaders)) { if (fake) { defunctClassLoaders = classLoaders; print("FAKING IT"); } else { print("No memory leaks."); ret; } } print("Calculating GC roots..."); for (Instance cl : defunctClassLoaders) { Instance progIDInstance = (Instance) cl.getValueOfField('progID); S moduleID = HeapWalker.stringValue(progIDInstance); print("Checking module ID: " + snippetWithTitle_cached(moduleID)); print("\nPath to GC root:"); printLinesWithGrowingIndent(map(func(Pair<Instance, S> p) -> S { joinNempties(" in ", p.b, heapWalker_className(p.a)) }, heapWalker_pathToGCRootWithFieldNames(cl))); print(); //Instance i = cl.getNearestGCRootPointer(); //print("i => " + i); } }
Began life as a copy of #1016518
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1016891 |
Snippet name: | Find references to defunct class loaders in Stefan's OS heap dump v2 [dev.] |
Eternal ID of this version: | #1016891/6 |
Text MD5: | fc7113785fb798675e535cfdcf1293bd |
Transpilation MD5: | 5f4c7414308135c1affe354aabe7b249 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-07-06 18:46:21 |
Source code size: | 1940 bytes / 55 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 537 / 1211 |
Version history: | 5 change(s) |
Referenced in: | [show references] |