However, there seems to be string "leak". Could you please take a look?
I've written a simple app with madExcept and FastMM4 that runs 24/7.
It connects to DB every minute and runs a stored procedure. So far so good.
Sometimes DB will be offline, so there's a timeout EOleException. madExcept logs it. Good too.
Now after several days there are 6 exceptions logged and FastMM4 reports that there are 17703 UnicodeStrings allocated.
Those strings seem to be "leaking" in big chinks. So the first day it's 260 strings, the second 260, the third - 17703.
I'm not sure if they are connected with exceptions logged by madExcept, but here is the allocation log:
Code: Select all
--------------------------------2017/5/24 7:32:15--------------------------------
Allocated block logged by LogAllocatedBlocksToFile. The size is: 68
This block was allocated by thread 0x18EC, and the stack trace (return addresses) at the time was:
40697A [System.pas][System][@GetMem$qqri][4305]
409FB7 [System.pas][System][@NewUnicodeString$qqri][23462]
40B1F3 [System.pas][System][@UStrSetLength$qqrr20System.UnicodeStringi][28745]
41D090 [madStrings][DecodeUtf8$qqrx27System.%AnsiStringT$us$i0$%]
430C6E [madMapFile][ReadPackedString]
43133B [madMapFile][Public_LoadFromStream]
431945 [madMapFile][ImportStr]
431A9A [madMapFile][GetMapFileFromResources]
4347C3 [madMapFile][TMapFile.$bctr$qqrox27System.%AnsiStringT$us$i0$%x20System.UnicodeStringuioo]
435C62 [madMapFile][FindMapFile$qqrpv]
77C30000 [Unknown function at RtlTryAcquireSRWLockExclusive]
The block is currently used for an object of class: UnicodeString
The allocation number is: 51550368
Which makes me think, that somehow strings get instantiated, but never get freed till the app is closed.
Could you lease take a look into this, is there a reason and a fix, why strings keep on being allocated and never freed?