“尺寸”有什么作用? Windbg !heap 输出中的数字意味着什么?

发布于 2024-08-30 07:41:14 字数 1332 浏览 1 评论 0原文

我在我的 DMP 文件中看到这样的输出:

Heap entries for Segment00 in Heap 00150000
    00150640: 00640 . 00040 [01] - busy (40)
    00150680: 00040 . 01808 [01] - busy (1800)
    00151e88: 01808 . 00210 [01] - busy (208)
    00152098: 00210 . 00228 [00]
    001522c0: 00228 . 00030 [01] - busy (22)
    001522f0: 00030 . 00018 [01] - busy (10)
    00152308: 00018 . 00048 [01] - busy (3c)

WinDbg 文档是这样说的:

    Heap entries for Segment00 in Heap 250000
                        0x01 - HEAP_ENTRY_BUSY            
                        0x02 - HEAP_ENTRY_EXTRA_PRESENT   
                        0x04 - HEAP_ENTRY_FILL_PATTERN    
                        0x08 - HEAP_ENTRY_VIRTUAL_ALLOC   
                        0x10 - HEAP_ENTRY_LAST_ENTRY      
                        0x20 - HEAP_ENTRY_SETTABLE_FLAG1  
                        0x40 - HEAP_ENTRY_SETTABLE_FLAG2  
Entry     Prev    Cur   0x80 - HEAP_ENTRY_SETTABLE_FLAG3  

Address   Size    Size  flags       (Bytes used)    (Tag name)
00250000: 00000 . 00b90 [01] - busy (b90)
00250b90: 00b90 . 00038 [01] - busy (38) 
00250bc8: 00038 . 00040 [07] - busy (24), tail fill (NTDLL!LDR Database)

尽管文档中的间距很奇怪。这是否意味着“条目地址”和“上一个大小”和“当前大小”,或者“条目”“上一个”和“当前”不适合下面的行?

“先前尺寸”和“当前尺寸”是什么意思?特别是关于“使用的字节”。 “使用的字节数”和“当前大小”之间有什么区别?

I see output like this in my DMP file:

Heap entries for Segment00 in Heap 00150000
    00150640: 00640 . 00040 [01] - busy (40)
    00150680: 00040 . 01808 [01] - busy (1800)
    00151e88: 01808 . 00210 [01] - busy (208)
    00152098: 00210 . 00228 [00]
    001522c0: 00228 . 00030 [01] - busy (22)
    001522f0: 00030 . 00018 [01] - busy (10)
    00152308: 00018 . 00048 [01] - busy (3c)

The WinDbg docs say this:

    Heap entries for Segment00 in Heap 250000
                        0x01 - HEAP_ENTRY_BUSY            
                        0x02 - HEAP_ENTRY_EXTRA_PRESENT   
                        0x04 - HEAP_ENTRY_FILL_PATTERN    
                        0x08 - HEAP_ENTRY_VIRTUAL_ALLOC   
                        0x10 - HEAP_ENTRY_LAST_ENTRY      
                        0x20 - HEAP_ENTRY_SETTABLE_FLAG1  
                        0x40 - HEAP_ENTRY_SETTABLE_FLAG2  
Entry     Prev    Cur   0x80 - HEAP_ENTRY_SETTABLE_FLAG3  

Address   Size    Size  flags       (Bytes used)    (Tag name)
00250000: 00000 . 00b90 [01] - busy (b90)
00250b90: 00b90 . 00038 [01] - busy (38) 
00250bc8: 00038 . 00040 [07] - busy (24), tail fill (NTDLL!LDR Database)

The spacing is weird in the docs though. Does that mean 'entry address' and 'prev size' and 'cur size', or are the 'entry' 'prev' and 'cur' not for the line below?

What does 'prev size' and 'cur size' mean? Especially with regard to 'bytes used'. What is the difference between 'bytes used' and 'cur size'?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

很糊涂小朋友 2024-09-06 07:41:14

堆段是给定堆的连续内存块。它也是一个堆条目链。

要向前遍历堆条目列表,我们可以使用 Cur Size 作为偏移量来到达下一个堆条目。

要向后遍历堆条目列表,我们可以使用 Prev Size 作为偏移量来到达上一个条目的开头。

在这里(下图)您可以看到 psize(先前的大小)及其与之前条目的大小(当前大小)的关系。

调试器输出图片

使用的字节数是通过从该块末尾未实际分配的未使用字节数中减去大小来计算的。这允许您在将请求的大小舍入到分配粒度之前确定所请求的分配的大小。

A heap segment is a continuous block of memory for a given heap. It is also a chain of heap entries.

To walk a list of heap entries forward we can use the Cur Size as an offset to get to the next heap entry.

To walk a list of heap entries backwards we can use the Prev Size as an offset to get to the beginning of the previous entry.

Here (picture below) you can see the psize (previous size) and its relationship to the size (current size) for the entry just before it.

Debugger Output Pic

The Bytes used is calculated by subtracting the size from the the number of unused bytes at the end of this block that were not actually allocated. This allows you to determine the size of the allocation that was requested before rounding the requested size to allocation granularity.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文