Board logo

Subject: 又有内存泄露 [Print This Page]

Author: niaoge    Time: 2007-7-27 16:38     Subject: 又有内存泄露

又有内存泄露 ,如下
A memory block has been leaked. The size is: 20
Stack trace of when this block was allocated (return addresses):
20003DAE [sys\system.pas][System][System.@GetMem][2654]
20007AA9 [sys\system.pas][System][System.@NewAnsiString][12429]
20007AD4 [sys\system.pas][System][System.@LStrFromPCharLen][12461]
22133334 [ComDebug.pas][ComDebug][ComDebug.CompGetSymbolText][323]
BC08E0B [SimpleWizards\CnProcListWizard.pas][CnProcListWizard][CnProcListWizard.TCnProcListForm.DoUpdateListView][1573]
50D07A [C:\Projects\Components\Delphi11\PSD40\FastMM4\FullDebugMode DLL\FastMM_FullDebugMode.dpr][FastMM_FullDebugMode][FastMM_FullDebugMode.GetRawStackTrace][317]
D25487 [GETMEM.INC][borlndmm][borlndmm.InitializeMemoryManager][4556]
D25499 [GETMEM.INC][borlndmm][borlndmm.InitializeMemoryManager][4559]
D2614B [borlndmm.pas][borlndmm][borlndmm.Finalization][111]
可能是TCnProcListForm.DoUpdateListView 没有把指针释放掉
delphi关闭时,FastMM 已经写了345M的日志,还在写


终于写完了,616M内存报告

[ 本帖最后由 niaoge 于 2007-7-27 16:44 编辑 ]
Author: niaoge    Time: 2007-7-27 16:47

俺专门给cw找麻烦
Author: Passion    Time: 2007-7-27 17:09

[SimpleWizards\CnProcListWizard.pas][CnProcListWizard][CnProcListWizard.TCnProcListForm.DoUpdateListView][1573]
这个我去找找。
Author: niaoge    Time: 2007-7-27 17:13

我在FormDestroy和DoUpdateListView内加了一个循环,好像看不到了,不知道对不对?
for I := FDisplayList.Count-1 downto 0 do
  begin
    FreeMemory(FDisplayList.Objects[I]);
  end;
Author: Passion    Time: 2007-7-27 17:19

在我们的设计中,FDisplayList里头并不持有实际的Object,Object全保存在FElementList中。
可能是FElmentList没释放内部的东西。
Author: Passion    Time: 2007-7-27 17:22

刚我看了下代码,应该是FElementList中没释放。
感谢niaoge帮我们找出了这个错误。
等出了330再帮我们测测。
Author: niaoge    Time: 2007-7-27 17:26



QUOTE:
原帖由 Passion 于 2007-7-27 17:22 发表
刚我看了下代码,应该是FElementList中没释放。
感谢niaoge帮我们找出了这个错误。
等出了330再帮我们测测。

不客气,
感谢cw给我们提供这么好的工具,能为cw做点小贡献也应该的
Author: niaoge    Time: 2007-7-27 18:31

还有几处,我以付件的形式发给你,DoUpdateListView那个删了以减少付件大小,
还好,当FastMM刚写日志时(60M左右)幸亏我用记事本打开,然后另存为,不过后面的600多M由于文件太大世上已没有工具能打得开,不过没关系,因为估计全是DoUpdateListView的,

[ 本帖最后由 niaoge 于 2007-7-27 18:33 编辑 ]

Attachment: bds_MemoryManager_EventLog1.rar (2007-7-27 18:31, 153.08 K) / Download count 464
http://bbs.cnpack.org/attachment.php?aid=339
Author: xjw100    Time: 2007-7-27 21:38

不过后面的600多M由于文件太大世上已没有工具能打得开
=========
不会吧,记事本应该可以打开的吧,慢而已吧。
用emditor几个GB的文件都可以打开。速度问题吧。
Author: niaoge    Time: 2007-7-27 22:43



QUOTE:
原帖由 xjw100 于 2007-7-27 21:38 发表
不过后面的600多M由于文件太大世上已没有工具能打得开
=========
不会吧,记事本应该可以打开的吧,慢而已吧。
用emditor几个GB的文件都可以打开。速度问题吧。 ...

用记事本提示内存不够,(俺的贱机内存2G)
用vs2005提示out of memory
emditor我没听说过,那616M的txt我删了,不然试一下,

FElmentList在free之前 把指针清空了,确实看不到内存Leak,没看到写内存日志

[ 本帖最后由 niaoge 于 2007-7-27 22:48 编辑 ]
Author: kendling    Time: 2007-7-30 08:57

用UltraEdit,关掉临时文件的使用,比你打开1M的文件还要快。
Author: shenloqi    Time: 2007-7-30 10:06

PSPad的ANSI版本打开600M的文件也非常快,记事本打开10M已经很慢了




Welcome to CnPack Forum (http://bbs.cnpack.org/) Powered by Discuz! 5.0.0