In my actual ISAPI project I have a recursive function which in some cases is called about 300 times. In a normal EXE project it works. But in an ISAPI DLL it doesn’t. It raises an AV like this: „stack overflow at 0x77c3805a“
After some searching I found the explanation: „the maximum stack size of a thread that is created in a native IIS process is 256 KB“ The stack size of a normal EXE program is 1 MB. There is also no difference between 32bit and 64bit.
Here are some more information which helped me:
Here is some example code:
procedure DoIt; procedure Recursion(const Step: Double); var aFormatSettings: TFormatSettings; aString: string; aNewStep: Double; begin //In my real project I got the AV during TFormatSettings.Create so I have made a demo with TFormatSettings.Create aFormatSettings := TFormatSettings.Create; aFormatSettings.DecimalSeparator := '.'; aString := FloatToStr(Step, aFormatSettings); aNewStep := StrToFloat(aString, aFormatSettings); aNewStep := aNewStep + 1; //in an ISAPI the AV raises by < 2000 steps //in an EXE the AV raises by < 200000 steps if Step < 2000 then Recursion(aNewStep); end; begin Recursion(1); end;