1

"It is important to note that a heap block might be considered busy in the eyes of the back end allocator but still not being used by the application. The reason behind this is that any heap blocks that go on the front end allocator’s look aside list still have their status set as busy." -- Advanced Windows Debugging p.267

My question reguarding this is : if the heap block status is set as busy , why would the front end allocator add it to the LAL as available for use ?

In other words, the status flag is either indicating either the block is busy or free. So why the free blocks aren't in the LAL , and how can those blocks be assigned to the LAL if their status flag is set to busy (they can be busy or not as the statement say) ?

4

1 回答 1

3

前端分配器会将其添加到 LAL 以供使用,因为它可供使用。该块被释放到前端分配器,这就是它首先获得块的方式。请求适当大小的块的前分配器的下一个调用者可以得到该块,因为从前端分配器的角度来看,它是免费的。它的客户都没有使用它。

LAL 的要点是最小化前端分配器使后端分配器所做的工作。所以前端分配器所做的是将释放给前端分配器的块保留在 LAL 中,而不是将它们返回给后端分配器。后端分配器显示它们很忙,因为它们很忙——前端分配器正在使用它们。但它们也是免费的,前端分配器可以分配它们,而无需更改它们在后端分配器中的状态。

如果前端分配器改变了 LAL 中块的忙碌状态,那将完全违背 LAL 的观点。每次在 LAL 上添加或删除块都需要与后端分配器交谈(以更改忙碌状态),而 LAL 的全部目的是防止前端分配器必须这样做。

于 2013-11-03T14:37:49.373 回答