Java应用程序内存大小 [英] Java application memory size

查看:109
本文介绍了Java应用程序内存大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当IntelliJ或Eclipse正在运行时,我可以从底部的进度条看到它们在应用程序内部使用了多少堆...它总是指示一个512 MB的子值,它是启动时分配的最大大小。
现在在很多情况下,如果我从操作系统(Linux)看它说该应用程序使用大约1300 MB,我知道库,堆栈,内存映射文件......不在堆中。 ..
但为什么差别那么大?通常有大约1GB的差异...为什么?

While either IntelliJ or Eclipse are running, I can see how much heap they are using from inside the application from the progress bar at the bottom.. it always indicates a sub 512 MB value which the max size allocated on startup. Now in many cases, if I look from the OS (Linux) it says that the app is using about 1300 MB, I understand that the libraries, stack, memory mapped files, ... are not in the heap... But why is the difference that big? There is usually about 1GB difference...Why?

谢谢。

推荐答案

此图像可以解释JVM内存使用情况:

JVM memory usage can be explained by this image:

如您所见,它不仅仅是 -Xmx 。总进程内存还包括 -XX:PermSize ,所有线程的堆栈大小,JIT和其他内部使用的JVM内存。不要忘记也包含在进程内存中的内存映射文件。 IntelliJ IDEA将内存映射文件用于缓存,因此它可以添加几百兆字节。

As you can see, it's not just -Xmx. Total process memory would also include the -XX:PermSize, stack size of all the threads, JVM memory used by the JIT and other internals. Don't forget about the memory mapped files which are also included in the process memory. IntelliJ IDEA uses memory mapped files for caches, so it can add several hundreds megabytes.

如果您需要详细信息,请使用一些分析器,如JConsole或YourKit。

If you need the details, use some profiler like JConsole or YourKit.

这篇关于Java应用程序内存大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆