Chromium Embedded的GuiDemo代码(https://code.google.com/p/delphichromiumembedded/)正在泄漏少量内存。数量不多,但是每次停止应用程序时都会从FastMM收到该消息非常烦人。我猜泄漏是在Chromium接口中。该单元具有“初始化”部分:
INITIALIZATION CefCache := 'cache'; CefRegisterCustomSchemes := CefOnRegisterCustomSchemes; CefRegisterSchemeHandlerFactory('dcef', '', True, TFileScheme);
日志是这样的:
A memory block has been leaked. The size is: 20 This block was allocated by thread 0x1674, and the stack trace (return addresses) at the time was: 40455E 4050A7 409C1D 405622 4050DC 4F0D7A 406598 406604 40A6C3 4F0E28 764CEE1C [BaseThreadInitThunk] The block is currently used for an object of class: main$174$ActRec The allocation number is: 323 --------------------------------2014/10/5 17:11:33-------------------------------- This application has leaked memory. The small block leaks are (excluding expected leaks registered by pointer): 13 - 20 bytes: main$174$ActRec x 1
问题是我不知道main $ 174 $ ActRec是谁。演示所在的单元实际上称为“ main.pas”。但是没有其他称为“ main”的变量。
main$174$ActRec
与用于支持匿名方法的接口相关联。因此,这应该为您提供如何查找泄漏的线索。
如果您包括一个异常日志记录套件,如madExcept,JCL的EurekaLog,您将从FastMM获得有意义的堆栈跟踪。这也将帮助您找到泄漏的来源。
一旦找到泄漏的内容,就应该有可能将其注册为预期的泄漏。但是,如果您可以确定泄漏了什么,那么我建议您尝试寻找一种不泄漏它的方法。
我们无法帮助您进一步确定泄漏,因为您没有提供更多信息。此项目有许多演示,但我不知道您正在运行哪个。