Hello,
I would like to use the stack to temporary store some data.
I just became aware that there is a need to hit (write to) the guard page to grow the stack in Windows. So growing works in 4 kilobyte steps only and not as I tried:
But when I am finished I would like to free the used memory again. So I tried something like this:esp -= 10 kilobyte
RAM[esp] = 123
And hoped that a task switch will trigger the deallocation of the pages. But in Windows it doesn't. I haven't tested it in Linux.esp += 10 kilobyte
Does someone know how to shrink the stack in Linux and Windows?
Btw: Does growing the stack also require an incremention in 4 kilobyte steps in Linux like it's necessary in Windows?