- edited description
Memory Leak when using ".DelegateTo()"
After getting mysterious memory leaks in my application, i narrowed them down to be caused by the .DelegateTo() procedure.
To reproduce, simply sue the Demo.SPring.DelegatedConstructor demo project, add FastMM with "ReportMemoryLeaksOnShutdown := True;" and run the project. It will leak "uDelegatedConstructor$3$ActRec x 1" (and a TUser).
Like this, registering any type with ".delegateTo()" causes the a leak of "$[UnitName]$x$ActRec x 1".
Comments (5)
-
reporter -
repo owner My magic crystal ball is telling me that you have the DelegateTo call either in the global main in the dpr or in some initialization part of a unit.
If that is true then this is not our fault but the compiler/memory manager and is a known issue (which I think will not be addressed - see http://qc.embarcadero.com/wc/qcmain.aspx?d=90194). To work around that write a routine that executes that code and call that whereever you have the code now.
Edit: Ok, after looking at the code that confirms my guess. I will fix the demos but that will not fix the issue you are having in your application. Also I can just recommend to not put registration code in initialization blocks (I blame the person that wrote bad demo code for teaching people wrong)
-
repo owner - changed milestone to 1.2
-
assigned issue to
- changed component to Demos
- marked as minor
-
repo owner - changed status to open
-
repo owner - changed status to closed
removed bad DI demos (closes issue
#104)→ <<cset 39ae4d55167f>>
- Log in to comment