Trivial Solutions The LoseThos 64-bit PC Operating System File:/LT/Demo/StkGrow.CPZ This, and all LoseThos files, are public domain. Do whatever you like. God is watching; God is just; God is never out-done in generosity. He talks! LoseThos code compiles with the 64-bit LoseThos compiler/assembler I wrote. Boot the LoseThos CD and you can compile it. Not in Kansas anymore! Click here for preliminary compiler information you need. I64 Recurse(I64 n) { if (n) return 1+CallStkGrow(0x800,0x1000000,&Recurse,n-1); else return 0; } I64 Recurse2(I64 n) { if (n) return 1+Recurse2(n-1); else return 0; } I64 Recurse3(I64 n,I64 lo,I64 hi) { if (lo<=n<hi) return 1+Recurse3(n-1,lo,hi); else if (n) return Recurse3(n-1,lo,hi); else return 0; } #define DEPTH (2*1024*1024) U0 StkGrowDemo() { F64 t0; t0=tP; "%X:%X\n",DEPTH,Recurse(DEPTH); "Time:%7.5fs\n",tP-t0; //If you know the max stack ahead of time... //Recurse2's stack is 16 because you have 1 arg, //a return addr and no local variables. t0=tP; "%X:%X\n",DEPTH,CallStkGrow(DEPTH*16+0x800,DEPTH*16+0x800,&Recurse2,DEPTH); "Time:%7.5fs\n",tP-t0; //CallStkGrow() works with multiple args. t0=tP; "%X:%X\n",DEPTH,CallStkGrow(DEPTH*32+0x800,DEPTH*32+0x800, &Recurse3,DEPTH,1000,2000); "Time:%7.5fs\n",tP-t0; } StkGrowDemo; //Be careful because you can fragment memory.