[fpc-pascal] ExceptProc no longer gets Frames if DLL host uses a different memory manager

OBones obones at free.fr
Fri May 18 17:51:04 CEST 2018


Hello,

I have a Win64 DLL compiled with FreePascal 2.6.0 in which I install a 
ExceptProc handler which signature is as follows:

procedure MyExceptProc(Obj: TObject; Addr: Pointer; FrameCount: LongInt; 
Frame: PPointer);

Up until recently, FrameCount was greater than zero and I could walk the 
frames just fine.
However, without recompiling the DLL, this has suddenly stopped working, 
FrameCount is now zero.

After a bit of investigation, it turns out that the host application 
that calls the DLL changed its memory allocator from TBBMalloc to 
libtcmalloc and this is that change that makes the frames disappear.
As I also have access to the sources for libtcmalloc, I looked into its 
code to see what it is doing, but I could not find anything obvious that 
would have the observed impact on my DLL.
That being said, I'm not familiar with the code that fills the 
FrameCount and Frame parameters when calling ExceptProc which is why I'm 
writing this message.
Would any of you have any suggestion as to what I should be looking for 
to explain that behavior?

Thanks in advance for your help.



More information about the fpc-pascal mailing list