Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Stack ovefrlow

2 views
Skip to first unread message

Stark

unread,
Sep 8, 2008, 9:18:42 AM9/8/08
to
I execute my application from the Delphi 6 IDE (I am developping it) and I
found that if I close it as soon as I open it, i get a stack overflow.
I wrote an "exit" at the beginning of the main form OnShow routine so that
nothing is happening, but the problem persists.
How do I investigate a stack overflow problem ? What is it that is possibly
causing such an error ?


Jamie

unread,
Sep 8, 2008, 6:17:32 PM9/8/08
to
You must have some units or third party controls in use, that
is causing the issue..

http://webpages.charter.net/jamie_5"

Stark

unread,
Sep 9, 2008, 1:28:26 PM9/9/08
to
No, I don't. How can I catch the exact point where the stack overflow
happens ? I get a panel with something looking as an assembler translation
of the code, but I don't understand it.

"Jamie" <jamie_ka1lpa_not_v...@charter.net> ha scritto nel
messaggio news:Kihxk.58104$4s1....@newsfe06.iad...

BRoberts

unread,
Sep 9, 2008, 6:55:44 PM9/9/08
to
"Stark" <franco...@tin.it> wrote in message
news:48c52680$0$1090$4faf...@reader1.news.tin.it...


The most common reason for Stack Overflow is unterminated recursion. In the
situation you describe it's most likely a case of indirect recursion. One
event does something that triggers another event that either does something
to trigger the first event or calls something that calls something else that
eventually ends up re-triggering an event and the cycle starts over.

If you can trap the overflow take a look at the call stack. It may take some
time but you will eventually figure out what is happening.

Jamie

unread,
Sep 9, 2008, 7:14:15 PM9/9/08
to
You need to start with a plan do nothing form!.

don't add any extra units.

Just start a new project and compile a blank form.

see if the error takes place. If so, you have some
corrupted lib files in your install of delphi which will
need a install of it and then any updates you may have had.

Also, try compiling a simply project not using run time
packages. If it then succeeds? You have a package file in the
system that is either corrupted or has been updated from some
other install of a program that was also written in D and is
not compatible.. But I would go with the corrupted file ..

It's very possible you in veritably altered one of the main
basic VCL files that gets used in all projects...

http://webpages.charter.net/jamie_5"

Stark

unread,
Sep 11, 2008, 8:59:26 AM9/11/08
to
It took me a while, but I did exactly what you suggested. I started from
scrap and ran a project with a form with a dbgrid, a PageControl with a
number of labels and panels. It was all right.
Then I introduced a very simple routine to do something on the OnCellDBGrid
event and got again the stackOverflow when closing.
I thought I understood, so I removed the routine bringing the project to the
initial stage, but now I keep getting the stack error.
In this project I am not using any third party components, Delphi components
only. This is also a fresh Delphi installation since a month ago I moved
from Windows 2000 to XP and started everything from scrap.
I am getting insane! Should I reinstall ro what ?

"Jamie" <jamie_ka1lpa_not_v...@charter.net> ha scritto nel

messaggio news:NdDxk.33$3_2...@newsfe02.iad...

Stark

unread,
Sep 11, 2008, 9:02:38 AM9/11/08
to
I forgot: I also tried with a blank form and with a form where I plainly
added the Delphi objects I use. This way everything was ok.

"Jamie" <jamie_ka1lpa_not_v...@charter.net> ha scritto nel

messaggio news:NdDxk.33$3_2...@newsfe02.iad...

Stark

unread,
Sep 11, 2008, 1:29:54 PM9/11/08
to
I can't trap the Overflow. How do I take a look at the call stack ?

"BRoberts" <berdon...@caneris.ca> ha scritto nel messaggio
news:c3d3d$48c6fda3$45c49fa8$25...@TEKSAVVY.COM-Free...

BRoberts

unread,
Sep 11, 2008, 11:19:15 PM9/11/08
to
"Stark" <franco...@tin.it> wrote in message
news:48c95594$0$1092$4faf...@reader1.news.tin.it...

>I can't trap the Overflow. How do I take a look at the call stack ?
>


You need to set a breakpoint or two. It's a little laborious because there
is a lot that generally goes on during creation. Eventually you will either
notice that the code is going somewhere unexpected or you will trip over a
breakpoint that you didn't expect. At that point you can look at the call
stack (debug windows) and see where the program has been.

Stark

unread,
Sep 13, 2008, 5:02:16 AM9/13/08
to
Unfortunately, I can't set any break point, since the StackOverflow is
raised aso soon as I close my application window (using the cross)...
And unfortunately I don't know how to get the call stack you metion.
Perhaps, I just don't know enough and that's why I get the problem ...


"BRoberts" <berdon...@caneris.ca> ha scritto nel messaggio

news:87b65$48c9dfbb$45c49fa8$20...@TEKSAVVY.COM-Free...

Rob Kennedy

unread,
Sep 13, 2008, 4:17:50 PM9/13/08
to
Stark wrote:
> "BRoberts" <berdon...@caneris.ca> ha scritto nel messaggio
> news:87b65$48c9dfbb$45c49fa8$20...@TEKSAVVY.COM-Free...
>> "Stark" <franco...@tin.it> wrote in message
>> news:48c95594$0$1092$4faf...@reader1.news.tin.it...
>>> I can't trap the Overflow. How do I take a look at the call stack ?
>>
>> You need to set a breakpoint or two. It's a little laborious because there
>> is a lot that generally goes on during creation. Eventually you will
>> either notice that the code is going somewhere unexpected or you will trip
>> over a breakpoint that you didn't expect. At that point you can look at
>> the call stack (debug windows) and see where the program has been.
>
> Unfortunately, I can't set any break point, since the StackOverflow is
> raised aso soon as I close my application window (using the cross)...

Set a breakpoint in your form's OnClose event handler. Start stepping
from there. You might want to set more breakpoints as you make progress,
so in case you need to start over, you can let the program run longer
before you start stepping.

> And unfortunately I don't know how to get the call stack you metion.
> Perhaps, I just don't know enough and that's why I get the problem ...

View, Debug windows, Call stack.

--
Rob

BRoberts

unread,
Sep 14, 2008, 8:56:24 PM9/14/08
to
"Stark" <franco...@tin.it> wrote in message
news:48cb819c$0$1084$4faf...@reader2.news.tin.it...

> Unfortunately, I can't set any break point, since the StackOverflow is
> raised aso soon as I close my application window (using the cross)...
> And unfortunately I don't know how to get the call stack you metion.
> Perhaps, I just don't know enough and that's why I get the problem ...

When you close your application it's quite likely that a number of your
event handlers are firing. Do you have any onDestroy onClose or onCloseQuery
event code? If so, put a breakpoint at the top of these handlers. If you
don't, then start looking at onChange events.

0 new messages