Windows stack and heap address ranges

后端 未结 1 455
余生分开走
余生分开走 2021-01-07 15:20

Working with Linux until now where stack addresses are very high and heap addresses are pretty low (as seen by printing heap and stack addresses using a C program), I have a

1条回答
  •  执笔经年
    2021-01-07 15:46

    Hm, stack addresses are higher than heap addresses - this is simply not true. Both stack and heap can reside anywhere in the address space of the process on Windows.

    If you start a lot of threads, make huge heap allocations and load hundreds of dlls, you will find that all these objects are evenly spread around the address space.

    enter image description here

    This picture shows the structure of virtual allocations in a typical 32-bit process on Windows. Green shows free areas, blue that something is allocated. Activity is mostly taking place in the beginning of the address space but in other address ranges it is present also.

    0 讨论(0)
提交回复
热议问题