3 ms·
The reasons why 64-bit programs require more stack memory
- Tekker 14y agoI would have preferred he simply turned off optimization, for clearer results, rather than obfuscate the code (and who knows what other optimizations were still in place).
- SparrowOS 14y agoI wrote my own compiler. Doesn't use REGs to pass values to functions. All pointers, stack or otherwise, are twice as big. If you are not a beginner, you probably use more pointers than nonpointers, so you're retarded! I have a fixed 128K size stack unless you want more. I keep memory identity-mapped, so the stack cannot grow. ---- The two main founding principles are identity-mapping and ring-0-only.
- mortenlarsen 14y agoOn Linux there seems to be little difference between 32 and 64 bit. It seems that the calling convention is different, and that no shadow space is allocated. I am not sure if this is how you are supposed to use the function. I only tried the first example, but I am not sure if I used it correctly. g++ stackuse_simple.cpp -o stackuse64 g++ -m32 stackuse_simple.cpp -o stackuse32 --------------------------------------------------------- //stackuse_simple.cpp #include <iostream> using namespace std; void StackUse(size_t *depth) { volatile size_t *ptr = 0; if (depth != NULL) ptr = depth; cout << *ptr << endl; (*ptr)++; StackUse(depth); (*ptr)--; } int main() { size_t d = 0; StackUse(&d); }