Jump to content
Jud

Strange stack overflow message

Recommended Posts

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 by Jud

Share this post


Link to post

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 by Fr0sT.Brutal

Share this post


Link to post

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×