Hi,
madshi wrote:Have you run this inside or outside of the IDE debugger?
Outside of the IDE debugger
I understand that in your test the time is good, 3.8 seconds for the 1,000 iterations, but the performance can change, adding the following variants:
1. The time, also increases if within the try-except is added
more code apart from the raise Exception,
for example creation of TDataSet's, etc.
2. The performance changes depending on the platform
the application, x32 or x64 bits
3. PC hardware
I appreciate the support, but HiddenExceptionHandler I can not use it, in an Application Server (multithreading application with high level of concurrency), where performance is a vital element, but thank you very much.
Just a question. Considering my objective, which is to save in a file the error message and the respective call stack which are Access Violation, I did the following,
and I was able to solve my goal, and without any impact on my performance:
Code: Select all
unit madExcept;
...
var OnAppHookExceptions: procedure(const pException: TObject; const exceptAddr: Pointer) = nil;
...
implementation
...
procedure InterceptFreeExceptObject(exceptObject: TObject);
begin
...
if (GetCurrentThreadId <> HandleExceptionTid) and
((@OnAppHookExceptions <> nil) Or ((HiddenHandlers ...) or (HiddenHandlersOO ...))) and
(exceptObject <> nil) and ... then begin
if @OnAppHookExceptions <> nil then
OnAppHookExceptions(exceptObject, System.ExceptAddr);
if ((HiddenHandlers ...) or (HiddenHandlersOO ...)) then
HandleException(etHidden, ...);
end;//if
...
end;
procedure HandleHiddenException(exceptObject: TObject; RaiseList: pointer);
var ...;
begin
if exceptObject <> nil then begin
try
...
except end;
if (GetCurrentThreadId <> HandleExceptionTid) and
((@OnAppHookExceptions <> nil) Or ((HiddenHandlers ...) or (HiddenHandlersOO ...))) and (RaiseList <> nil) and
(MadException(...)...) and
IsValidObject(...) then begin
ea:= nil;
TryRead(...);
if @OnAppHookExceptions <> nil then
OnAppHookExceptions(exceptObject, ea);
if ((HiddenHandlers ...) or (HiddenHandlersOO ...)) then
HandleException(etHidden, ...);
end;
end;
end;
Any suggestion or opinion of the source code added to the madExcept unit?
Thanks in advance.