Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试获取我的 Java 进程在 Windows 系统中使用的物理和虚拟内存,就像 taskmgr 一样。
我能够获得我的 Java 进度的物理内存,但我无法获得虚拟内存。现在我正在考虑使用 Windows API 来获取进程虚拟内存,但是,我找不到正在工作的函数。
还有其他方法可以获取我的 java 进度的虚拟内存吗?
问题解决了!
long size = 0; OperatingSystemMXBean osm = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); if (null != osm) { size = osm.getCommittedVirtualMemorySize() / 1024L; }