Exception Handling (with report back) without Profiling

Could this be used for exception handling only? So in debug we would want full profiling available but on release the advanced exception handling (with reporting back to us) would be helpful. (We have some systems that use MADExcept for that currently).

Also for logging we have been wanting to include in the code that logs the message the unit name, method name and line number which is standard information with a C compiler but we have not been able to get it in Delphi - is this available in TMS MemInsight?

Hello Rob,
I did read your request. Please give me some time to answer. I will get back to you as soon as possible, not later than tomorrow evening (european time). Both is possible: full profiling in debug mode, exception handling in release mode only. Though reporting back is not implemented this can be achieved easily and could also be a nice feature to add to MemInisght. Also an utility function is available for the second part of your question.
Kind regards
Stefan

Hello Rob,

your case is an example using TMS MemInsight without GUI.

Add the units TMS.MI.Access and TMS.MI.Core to your project
Enable/Disable the MemoryProfiling maybe with an IFDEF DEBUG or IFDEF RELEASE

MemoryProfiler.Active := True | False;

Initialize and activate the ExceptionHandler

ExceptionHandler.InitializeStackTraceProvider;
ExceptionHandler.Active := True;

Add an ordinary

Application.OnException := DoException;

procedure TForm1.DoException(Sender: TObject; E: Exception);
begin
if Assigned(e) then
ShowMessage(e.StackTrace);
end;

Detailled MAP files need to be switched on under "Linker" and the MAP file needs to be accessible. In an upcoming update these can embedded as resource file; currently this is not yet implemented.

Sending this back to your system is up to you as they are so many variations. If you send me a message I can forward you some code I have which might go into TMS MemInsight in one of the next updates.

To solve your last question, you can use GetCurrentName from TMS.MI.Core

procedure TForm1.Button3Click(Sender: TObject);
begin
ShowMessage(GetCurrentName);
end;

I hope this answers your question,
Kind Regards
Stefan

Some remark: please be aware that the first call of GetCurrentName or the first exception might need a little bit more time as the MAP file is being read within a thread. In case, this thread is not yet done, the code needs to wait so it can resolve the method names.

Thanks Stefan. I hope to be trying this out in the near future!