дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 09:11:10 +02:00
Capture a heap dump of the debugged JVM over the attach listener (GC.heap_dump, after checking free disk space and the JDK's rules for suspended VMs) or open an .hprof file, and browse it in an editor tab: classes with shallow and retained sizes, biggest objects, dominators, the path from an object to a GC root, and a comparison of two snapshots. A snapshot captured at a stop adds a Retained Size column to that stop's Memory tab. New crate ide-heap: HotSpot hprof parser (bounds-checked; unfinished or crafted dumps are refused), object graph, dominator tree (semi-NCA), retained sizes and GC-root paths. Snapshots live in private directories removed with their window; an opened dump is analyzed from a private copy so changes to the user's file can't affect the mapped data. Co-authored-by: ntbang0901 <[email protected]>
33 рядки
1.4 KiB
TypeScript
33 рядки
1.4 KiB
TypeScript
import { tx } from "@/platform/i18n";
|
|
import type { JvmMemoryUnavailable } from "@/platform/ipc";
|
|
|
|
/** Why the class table could not be read; a heap capture refused for the same reason reuses it. */
|
|
export function unavailableText(reason: JvmMemoryUnavailable): string {
|
|
switch (reason.kind) {
|
|
case "attachedJvmNotFound":
|
|
return tx(
|
|
"Memory view needs a JVM on this computer started with -XX:+StartAttachListener. Programs the IDE debugs get it automatically.",
|
|
);
|
|
case "listenModeNotSupported":
|
|
return tx("Memory view is not available when the IDE listens for the JVM to connect.");
|
|
case "unsupportedPlatform":
|
|
return tx("Memory view is not available on this platform yet.");
|
|
case "noJvmProcess":
|
|
return tx("Could not find the program's JVM process.");
|
|
case "listenerNotRunning":
|
|
return tx(
|
|
"The JVM does not accept attach requests. Restart the debug session without -XX:+DisableAttachMechanism.",
|
|
);
|
|
case "unsafeWhileSuspended": {
|
|
const v = reason.javaMajor;
|
|
return v > 0
|
|
? tx`JDK ${v} cannot report memory while suspended. Resume the program, then refresh.`
|
|
: tx("This JDK cannot report memory while suspended. Resume the program, then refresh.");
|
|
}
|
|
case "programExited":
|
|
return tx("The program has exited.");
|
|
case "timedOut":
|
|
return tx("The JVM did not answer within 10 seconds.");
|
|
}
|
|
}
|