简体   繁体   English

如何使用堆转储来计算堆碎片化统计信息

[英]How to calculate heap fragmenation statistics using heap dumps

有谁知道是否有任何工具可以使用堆转储来计算堆碎片?

I have a tool to visualize the heap (http://bobah.net/d4d/tools/cpp-heapmap) but it consumes the list of {op;address;size} triplets, not a raw heap dump. 我有一个可视化堆的工具(http://bobah.net/d4d/tools/cpp-heapmap),但是它消耗{op; address; size}三元组的列表,而不是原始堆转储。 You can use it to visually estimate how bad the heap is. 您可以使用它来直观地估计堆的严重程度。 In some cases it's just enough. 在某些情况下,这就足够了。 It's malloc interceptor would obviously not fit for Java app, but the UI does not care where numbers come from and would display ones from any source. 它是malloc拦截器,显然不适合Java应用程序,但是UI不在乎数字来自何处,而是显示任何来源的数字。

But let's assume we are able build a heap map from the dump (I'm sure someone will answer here how exactly). 但是,假设我们能够从转储中构建堆映射(我敢肯定有人会在这里给出准确的答案)。 The main part of the problem is to calculate fragmentation curve F(s), s - target allocation size. 问题的主要部分是计算碎片曲线F(s),s-目标分配大小。 F(s) - the ratio of (total_free_space/s), to number of blocks of size s which can actually be allocated considering particular heap layout. F(s)-(total_free_space / s)与大小为s的块数之比,可以考虑特定的堆布局实际分配。

Once the F(s) is built, one can integrate it in the interval from 1 to S (total heap size) to have a single number representing the heap fragmentation or usage efficiency. 一旦构建了F,便可以在1到S(总堆大小)的间隔中对其进行积分,以得到一个表示堆碎片或使用效率的数字。

IBM垃圾收集和内存分析器非常适合此类情况,并且是免费的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM