Windows heap manager and heap segments

I found the following sentence in a book :

Whenever the heap manager runs out of committed space in the heap segment, it explicitly commits more memory and divides the newly committed space into blocks as more and more allocations are requested

Does this mean when a block is allocated in the segment the virtual memory used by the user and the metadata isn't considered committed anymore ?


This is from the advanced windows debugging book I take it, not sure what you mean as you get kind of vague towards the end, however what it basically means is as follows:

When you allocate heap space the contents of the heap are not necessarily pre-determined, so you can use that allocated space as you see fit: for example, I allocate 1 megabyte of heap memory, and I then decide to populate that space with only 512k or data, that would mean I have committed half of my allocated heap, leaving a further 512k free. That memory will still show as being utilised to the OS because I have explicitly set the heap allocation to 1024k, however next time I use that same space I could use more or less than the 512k I utilised last time, up to the amount I have allocated for use. The amount you use at a given point is the commit, the amount you have set aside is the allocation.

This is all much much simplified, and I would recommend reading such sources as:

  • stack-memory-vs-heap-memory from here
  • the-stack-and-the-heap from learn CPP
  • Memory_Stack_vs_Heap from CBootCamp
  • As good sources to get you started on memory and its usage in C++.

    If there is anything specific or more detail you can think of (your question is a bit unclear) then let me know and I will get back to you as soon as possible.


    编号分配的块是承诺内存的一部分。

    链接地址: http://www.djcxy.com/p/79800.html

    上一篇: 在C / C ++中对大数组大小运行时错误

    下一篇: Windows堆管理器和堆段