Why is the stack filled with 0xCCCCCCCC

后端 未结 2 541
名媛妹妹
名媛妹妹 2020-12-09 04:18

I\'m currently disassembling some small C programs made in Visual Studio 2012 Express, and i\'ve noticed a trend amongst the binaries.

The first set of instructions

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-09 05:04

    I can not speak for Visual Studio, but some environments in which I've coded have deliberately filled the stack with a predetermined value (such as 0xcccccccc). This was done so that the stack could be scanned (starting from the bottom) to determine how much had not been used. On embedded systems where the amount of memory can be rather limited, this is rather useful during development so that the memory usage can be optimized.

    Hope this helps.

提交回复
热议问题