问题标签 [heap-dump]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
6 回答
2832 浏览

php - 在 OutOfMemory 异常上让 PHP 转储堆

我目前正在调试一个不断遇到 OutOfMemory 异常的脚本。它作为 cronjob 运行并且通常运行良好,但是当 cronjob 有一段时间没有运行(无论出于何种原因)时,脚本必须处理许多排队的元素,并且会遇到 OutOfMemory 异常。

通过检查代码,我无法发现问题。我相信其中一个迭代函数调用可能会泄漏内存,但我不确定是哪一个以及在哪里。当发生 OutOfMemory 异常时,是否可以选择让 PHP 转储堆?我也许可以从那里发现问题(很可能)。

0 投票
1 回答
537 浏览

java - Difference between System.gc() and dead object reclamation performed by taking a live-only heap dump?

There are at least two ways, directly or indirectly, of suggesting that the JVM expend effort collecting garbage:

  • System.gc()
  • taking a heap dump and requesting live objects only

In the latter, I can get hold a heap dump programmatically, for example through

What difference, if any, is there between what these two operations will do to collect non-strongly-reachable objects?

I believe I have evidence that the heap dump approach is more aggressive than System.gc() in the presence of some combination of weak references, RMI distributed garbage collection and invisible objects strongly-reachable from the stack. In particular that objects that are only weakly reachable locally and have become Unreferenced with respect to RMI appear to be collected only by the heap dump. I haven't yet been able to distil this into a small test case, but it is reproducible.

(Before I'm warned against relying on particular GC behaviour in prod code, I'm not. I discovered this while investigating a potential memory leak, and noticed that the result varied depending on when I took the heap dump. I'm just curious.)

This is using HotSpot 64-Bit Server VM 1.6.0_22 on Windows 7.

0 投票
7 回答
58410 浏览

java - 分析离线 Java 堆转储 (.hprof) 的工具或技巧

是否有任何工具允许对 .hprof 文件进行离线分析(包括摘要/排序/筛选)?或者你可以在批处理模式下运行 VisualVM、hat 等吗?

我对可以输入 .hprof 文件、处理它并生成报告的东西感兴趣。

我假设您需要传递一系列选项来配置报告,所以如果您知道任何有用的提示,请权衡一下。

最好是可编写脚本的,这样我就可以一次运行一堆。

0 投票
3 回答
6374 浏览

java - 如何使用 jhat 分析堆转储

我在堆转储上运行了 jhat,它生成了报告。我如何使用报告来分析堆。除了实例计数之外,我无法完全理解。有没有这方面的参考资料或案例研究。简而言之,我需要继续前进,我该怎么做?

还有什么是对象查询语言。

0 投票
2 回答
1170 浏览

java - 如何分析 Dalvik GC 行为?

我正在Android上开发一个应用程序。它是一个长期运行的应用程序,可以持续处理传感器数据。在运行应用程序时,我在 logcat 中看到很多 GC 消息;大约每秒一个。

这很可能是因为在循环中创建并立即取消引用的对象。

如何找到正在创建和立即释放的对象?

我尝试过的所有 Java 堆分析工具(*)都被堆上对象的数量和大小所困扰。虽然它们很有用,但我更感兴趣的是找出创建临时短期对象最多的站点。

(*) 我试过jcatEclipse MAT。我无法hat处理 Android 堆转储;它抱怨不支持的转储文件版本。

0 投票
2 回答
4149 浏览

java - JVisualVM“堆转储”按钮可以释放内存吗?

我有一个非常奇怪的问题。我正在开发一个基于 Eclipse Equinox 的 OSGi 应用程序;它是使用 OSGi 日志服务(Equinox 实现)开发的,现在我正在使用 Apache Felix OSGi 日志服务实现对其进行测试。

在 API/代码方面,一切正常:OSGi 日志服务是标准的,所以我可以毫无问题地从 Equinox 切换到 Felix。

但是,我观察到这种奇怪的行为:我将应用程序作为控制台程序启动,以查看控制台上的日志输出,并将其附加到 JVisualVM 以分析内存使用情况;JVisualVM 图显示了一个 80 MB 的已用堆。

13 小时后,平均堆大小达到 220 MB,所以我决定分析堆转储,并按下“堆转储”按钮:在此操作后,JVisualVM 图显示已用堆为 20(min)-35 (max)MBs (?!?!),并且这个值是恒定的。

“堆转储”操作可以释放近 200 mbs 吗?如果是,为什么?

我从未在 Equinox OSGi 日志服务实现中看到这种行为,所以我怀疑 Felix 日志涉及到这个问题......

谢谢

0 投票
3 回答
5536 浏览

java - Huge heap dump (11GB) - Jhat failed & Eclipse MAT needed help

We got a memory error in our EA and we used -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/path/to/some/dir to dump the heap at the time of OOM.

We had a heap memory of 12GB and perm gen of 256MB.

The heap dump is generated in the Linux box where we have our application running and its size is 11.5GB. We don't have privileges to download it to our local.

When we tried to analyze that 11GB heap dump using JHAT it thrown an OOM.

We tried the following commands from our Linux CLI.

For all the options its throwing an OOM exception after reading the dump for several minutes(>30 mins).

We googled it and found MAT as a powerful heap dump analyzer, but not a way to use it in LINUX.

Any suggestions would be of greater help. Thanks.

Modified:

Got MAT installed in Linux x86_64 machine but got following error when executed ./MemoryAnalyzer

I tried ./ParseHeapDump.sh ../java_pid1491.hprof this and got following error,

0 投票
2 回答
3918 浏览

java - Eclipse memory analyser - error on trying to acquire heap dump

I am trying to acquire heap dump using the Eclipse Memory Analyzer Tool (MAT). I have Weblogic 10.3 app server running. It's a windows XP OS with 32 bit Java installed. When I try to acquire heap dump using MAT for the process that's running Weblogic, I am getting the following error:

Any help is appreciated.

Thanks, Sid

0 投票
3 回答
3739 浏览

java - 如何分析大型堆转储?

如果只能为 JVM 分配 1.5GB,是否有分析大型 Java 堆转储(2GB)的工具?我不敢相信转储必须完全加载到内存中才能进行分析......

Eclipse MemoryAnalyzer 失败了,IBM 工具也失败了。

我现在需要在这里使用命令行工具吗?

0 投票
1 回答
217 浏览

groovy - 在堆转储中查找 GroovyConsole 脚本的字符串版本

我不小心在 GroovyConsole 中运行了一个带有无限循环的脚本。:-\

为了墨菲定律,我在 3 或 4 小时内没有保存我的工作。所以,在杀死 GroovyConsole 进程之前,我已经转储了堆,希望找到此时正在运行的脚本的字符串版本

您是否有提示它可以隐藏在哪个类中,或者是否有可能?