I have an application written in Delphi W32 that is in beta.
On the test PC, it haphazardly kicks out a stack overflow message after a few hours of use.
How can I trap the error and find the cause?
Can I increase the Stack size?
I have an application written in Delphi W32 that is in beta.
On the test PC, it haphazardly kicks out a stack overflow message after a few hours of use.
How can I trap the error and find the cause?
Can I increase the Stack size?
Get madExcept and it will tell you exactly what is happening at the time of the fault. You ll see the full stack, and particularly where it is running away.
You should REDUCE the stack size in linker options. Then run it under the debugger and hopefully the problem will show up without your having to wait two hours.
I d almost say: run it in the debugger ;^)
What I used to do is add a enter and leave log function in every method. With the proper indentation I could trace in the log the callpath.
When a stackoverflow would occur it would really be visible in the log since the indentation level should be through the roof
void someMethod()
{
logMethodEnter("someMethod");
... do stuff...
log("something")
... do stuff...
logMethodLeave("someMethod");
}
the logger would keep track of current logdepth and log stuff like this:
>someMethod
something
<someMethod
Do you have the IDE installed on the test machine? If so, try to reproduce the problem from within the IDE. When the stack overflow occurs, look at the Call Stack (View->Debug Windows->Call Stack). It will probably have the same function being called many times, like this:
FunctionA
FunctionB
FunctionA
FunctionB
FunctionA
FunctionB
...
If you see that, then you know that these functions are calling each other without ever concluding.
If you don t have the IDE installed on the test machine, then you can still do this via remote debugging. If you provide a little more information about your scenario we may be able to help more.
Specifically it might be helpful to know:
You can increase the stack size using the project linker options or the $M compiler directive, but I don t think it wil solve the problem unles the stack is really small.
If you run the application in the debugger, it will break at the exception eventually.
If you are using a thread(not main ex:sock connection) and main thread so they share the same stack. Solve this way :just create a thread with its own stack for each connection.
Problem > each call you do it call stack for frame (the shared one so big problem) example you call proc aa(a,b:integer) for example on calling always the same function or different one ;
You have a socket thread running, and onconnect you call proc a; and stays doing something it take 5 secs.
if some one connects before the on connect close connection (release stack). You have the 2 connected clients (2 diff stack frames with each different data)
stack
push a,b (integer); Values 5,10 - from 1 conn
push a,b (integer); Values 7,3 - from 2 conn
if the onconnect call the functions a(5,10) and stays doing something for about 5 sec. and some one connect to the server socket again it call on connect again.
The stack olds the first call frame yet didn t went out of proc. So didn t pop a,b from (5,10)
It is more complex than this if you proc call again then it will override data on the 2 frame (local proc variable of 2 connection) so when 2 connection get data from stack is already overridden by other info for sure. so it will do incorrect behavior.
When first connection is down will pop a,b but 7,3 (from second connection) and not the 5,10 it saved. so it will stack overflow not on the moment but later with the program running and stack release errors you ll get eventually a $FFFFFFFF $SP
stack. so it will try to $FFFFFFAA
when you call a function so is bigger than ya stack ex: $M 65536
and not 4 gigabytes as $FFFFFFAA
.
my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...
Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...
i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...
In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...
What is the equivalent of SetLength using Oxygene? I m trying to size an integer array. var listIndexes: array of integer; begin setLength(listIndexes,5); // doesn t work end;
How can I monitor or visualize memory fragmentation of a delphi application?
I have consistently had IDE problems in Delphi/C++Builder for years, with every version. I usually just reboot, recompile, etc. and move on. However, I keep seeing others say that the IDE is rock ...
I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...