Jud 1 Posted December 27, 2021 (edited) On some programs I get strange stack overflow messages. For instance, in a program that I'm working on in Delphi 11 now. In the IDE, I run it, enter some stuff into VCL controls, and click a button to run a procedure. It all works. As long as I have it running, I can run the procedure again, with or without new parameters. If I exit from the IDE, restart the IDE, DON'T make any changes to the source code, and try to run it, it gives a stack overflow message at the first line of the procedure when I click the button to run it. If I make ANY change to the source code, even adding a space and leaving it in or removing it, then I don't get the stack overflow message. Also, after I get the stack overflow message in the IDE, if I then exit the IDE and run the EXE, I get the stack overflow message. Does anyone know what is happening and how to fix it (other than making a change to the source code between each run)? Additional information: it happens in 64-bit mode but not 32-bit mode. Edited December 27, 2021 by Jud Share this post Link to post
David Heffernan 2345 Posted December 27, 2021 Answer found in the code which we can't see. Share this post Link to post
Fr0sT.Brutal 900 Posted December 27, 2021 (edited) I guess it's time to call an exorcist as your app was cursed. Jokes aside: try to comment out parts of the proc to achieve stable behavior without SO. Then examine what's wrong in commented lines Edited December 27, 2021 by Fr0sT.Brutal Share this post Link to post
FPiette 383 Posted December 27, 2021 I would suggest this: 1) Close the IDE. 2) Make sure you have the source code and DCU files in only one place on all your hard drives. (I you need to keep previous version as backup, move it to a zip file). Later, when the issue is sorted out, of course you may have several copies in different directories not accessible by the IDE. 3) Start the IDE and load the project having the issue, only that project, not a group of projects. 4) From project manager, right click on the project node and click "clean". 5) From project manager, make sure "debug" build is active and right click on the project node and click "Build". 6) In the source code, put a break point on the "begin" of the buttonclick procedure for the button. 7) In the source code, put a break point on the "begin" of the procedure/function where the stack overflow occurs. 8 ) Run the debugger (F9). Enter data in the user interface and click that famous button. 9) Your first break point should be hit 10) Run step by step using F7 (F8 to not enter RTL function/procedure). 11) See if all lines execute as you expect. Take special attention to recursive call to one of your function/procedure (That is call one before it has exited). Recursive call without having a mean to break the recursion is what you are looking for. Share this post Link to post