Search code examples
delphidllruntimepackagefastmm

FastMM, stack trace memory for leaks in dynamicly loaded DLL, compiled with runtime packages


I'm using FastMM together with JCL Debug info to trace memory leaks in my application. However I have plugins which are dlls compiled in Delphi, both dlls and main application use common runtime packages. Now, when I'm shutting down the application, it generates memory leaks report in text file which is fine, but it contains stack traces only for main application. If memory leak occurs in plugin dll, the stack trace leads to LoadPlugins; procedure in main application! Of course my plugins contain JCL debug data (it's inserted into .dll binary).

Where is the problem? Is that because of runtime packages usage? Or some switch (define) which I forgot to enable/disable? Thanks in advance


Solution

  • Pierre, author of FastMM has answered my question. If anyone is interested, the solution is not to unload plugins at shutdown in order to keep stack traces & object types accessible. This however caused tons of bugs on shutdown (since FastMM was unloaded twice or so), so finally I had to move FastMM to shared package...