100多个都是系统的或者第三方控件idhttp,regexpr等的。节选:--------------------------------2006/7/9 12:18:39--------------------------------
A memory block has been leaked. The size is: 12Stack trace of when this block was allocated (return addresses):
402B23 [system.pas][System][@GetMem][2463]
404859 [system.pas][System][@NewAnsiString][11990]
404E0D [system.pas][System][@LStrSetLength][13156]
532027 [Unit1.pas][Unit1][TForm1.VirtualStringTree1LoadNode][925]
4F6236 [..\Source\VirtualTrees.pas][VirtualTrees][TBaseVirtualTree.DoLoadUserData][18699]
4FD4DD [..\Source\VirtualTrees.pas][VirtualTrees][TBaseVirtualTree.ReadChunk][22092]
40DDD9 [sysutils.pas][SysUtils][FileSeek][5073]
50A1EB [..\Source\VirtualTrees.pas][VirtualTrees][TCustomVirtualStringTree.ReadChunk][29822]
4FD62D [..\Source\VirtualTrees.pas][VirtualTrees][TBaseVirtualTree.ReadNode][22132]The block is currently used for an object of class: UnknownThe allocation number is: 3937Current memory dump of 256 bytes starting at pointer address 1A17CE8:
01 00 00 00 01 00 00 00 30 00 49 2A CD F7 80 80 00 00 00 00 E0 4B A1 01 00 00 00 00 00 00 00 00
FF FF FF FF 00 00 00 00 63 0F 00 00 23 2B 40 00 59 48 40 00 0D 4E 40 00 27 20 53 00 36 62 4F 00
DD D4 4F 00 D9 DD 40 00 EB A1 50 00 2D D6 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 00 00 00 00 20 FB 35 04
01 00 00 00 01 00 00 00 31 00 DF 04 CA FB 80 80 00 00 00 00 E0 4B A1 01 00 00 00 00 00 00 00 00
FF FF FF FF 00 00 00 00 65 0F 00 00 23 2B 40 00 59 48 40 00 0D 4E 40 00 27 20 53 00 36 62 4F 00
DD D4 4F 00 D9 DD 40 00 EB A1 50 00 2D D6 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 00 00 00 00 A2 FB 35 04
.  .  .  .  .  .  .  .  0  .  I  *  ? ? €  €  .  .  .  .  ? K  ? .  .  .  .  .  .  .  .  .
        .  .  .  .  c  .  .  .  #  +  @  .  Y  H  @  .  .  N  @  .  '     S  .  6  b  O  .
? ? O  .  ? ? @  .  ? ? P  .  -  ? O  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .     ? 5  .
.  .  .  .  .  .  .  .  1  .  ? .  ? ? €  €  .  .  .  .  ? K  ? .  .  .  .  .  .  .  .  .
        .  .  .  .  e  .  .  .  #  +  @  .  Y  H  @  .  .  N  @  .  '     S  .  6  b  O  .
? ? O  .  ? ? @  .  ? ? P  .  -  ? O  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  ? ? 5  .--------------------------------2006/7/9 12:18:39--------------------------------
A memory block has been leaked. The size is: 12Stack trace of when this block was allocated (return addresses):
402B23 [system.pas][System][@GetMem][2463]
404859 [system.pas][System][@NewAnsiString][11990]
404E0D [system.pas][System][@LStrSetLength][13156]
532027 [Unit1.pas][Unit1][TForm1.VirtualStringTree1LoadNode][925]
4F6236 [..\Source\VirtualTrees.pas][VirtualTrees][TBaseVirtualTree.DoLoadUserData][18699]
4FD4DD [..\Source\VirtualTrees.pas][VirtualTrees][TBaseVirtualTree.ReadChunk][22092]
40DDD9 [sysutils.pas][SysUtils][FileSeek][5073]
50A1EB [..\Source\VirtualTrees.pas][VirtualTrees][TCustomVirtualStringTree.ReadChunk][29822]
4FD62D [..\Source\VirtualTrees.pas][VirtualTrees][TBaseVirtualTree.ReadNode][22132]The block is currently used for an object of class: UnknownThe allocation number is: 3939Current memory dump of 256 bytes starting at pointer address 1A17D68:
01 00 00 00 01 00 00 00 31 00 DF 04 CA FB 80 80 00 00 00 00 E0 4B A1 01 00 00 00 00 00 00 00 00
FF FF FF FF 00 00 00 00 65 0F 00 00 23 2B 40 00 59 48 40 00 0D 4E 40 00 27 20 53 00 36 62 4F 00
DD D4 4F 00 D9 DD 40 00 EB A1 50 00 2D D6 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 00 00 00 00 A2 FB 35 04
01 00 00 00 01 00 00 00 32 00 5D 04 CA FB 80 80 00 00 00 00 E0 4B A1 01 00 00 00 00 00 00 00 00
FF FF FF FF 00 00 00 00 67 0F 00 00 23 2B 40 00 59 48 40 00 0D 4E 40 00 27 20 53 00 36 62 4F 00
DD D4 4F 00 D9 DD 40 00 EB A1 50 00 2D D6 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 00 00 00 00 24 FC 35 04
.  .  .  .  .  .  .  .  1  .  ? .  ? ? €  €  .  .  .  .  ? K  ? .  .  .  .  .  .  .  .  .
        .  .  .  .  e  .  .  .  #  +  @  .  Y  H  @  .  .  N  @  .  '     S  .  6  b  O  .
? ? O  .  ? ? @  .  ? ? P  .  -  ? O  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  ? ? 5  .
.  .  .  .  .  .  .  .  2  .  ]  .  ? ? €  €  .  .  .  .  ? K  ? .  .  .  .  .  .  .  .  .
        .  .  .  .  g  .  .  .  #  +  @  .  Y  H  @  .  .  N  @  .  '     S  .  6  b  O  .
? ? O  .  ? ? @  .  ? ? P  .  -  ? O  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  $  ? 5  .--------------------------------2006/7/9 12:18:39--------------------------------
A memory block has been leaked. The size is: 12Stack trace of when this block was allocated (return addresses):
402B23 [system.pas][System][@GetMem][2463]
404859 [system.pas][System][@NewAnsiString][11990]
404E0D [system.pas][System][@LStrSetLength][13156]
532027 [Unit1.pas][Unit1][TForm1.VirtualStringTree1LoadNode][925]
4F6236 [..\Source\VirtualTrees.pas][VirtualTrees][TBaseVirtualTree.DoLoadUserData][18699]
4FD4DD [..\Source\VirtualTrees.pas][VirtualTrees][TBaseVirtualTree.ReadChunk][22092]
40DDD9 [sysutils.pas][SysUtils][FileSeek][5073]
50A1EB [..\Source\VirtualTrees.pas][VirtualTrees][TCustomVirtualStringTree.ReadChunk][29822]
4FD62D [..\Source\VirtualTrees.pas][VirtualTrees][TBaseVirtualTree.ReadNode][22132]The block is currently used for an object of class: UnknownThe allocation number is: 3941Current memory dump of 256 bytes starting at pointer address 1A17DE8:
01 00 00 00 01 00 00 00 32 00 5D 04 CA FB 80 80 00 00 00 00 E0 4B A1 01 00 00 00 00 00 00 00 00
FF FF FF FF 00 00 00 00 67 0F 00 00 23 2B 40 00 59 48 40 00 0D 4E 40 00 27 20 53 00 36 62 4F 00
DD D4 4F 00 D9 DD 40 00 EB A1 50 00 2D D6 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 00 00 00 00 24 FC 35 04
01 00 00 00 01 00 00 00 33 00 DB 03 CA FB 80 80 00 00 00 00 E0 4B A1 01 00 00 00 00 00 00 00 00
FF FF FF FF 00 00 00 00 69 0F 00 00 23 2B 40 00 59 48 40 00 0D 4E 40 00 27 20 53 00 36 62 4F 00
DD D4 4F 00 D9 DD 40 00 EB A1 50 00 2D D6 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 00 00 00 00 A6 FC 35 04
.  .  .  .  .  .  .  .  2  .  ]  .  ? ? €  €  .  .  .  .  ? K  ? .  .  .  .  .  .  .  .  .
        .  .  .  .  g  .  .  .  #  +  @  .  Y  H  @  .  .  N  @  .  '     S  .  6  b  O  .
? ? O  .  ? ? @  .  ? ? P  .  -  ? O  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  $  ? 5  .
.  .  .  .  .  .  .  .  3  .  ? .  ? ? €  €  .  .  .  .  ? K  ? .  .  .  .  .  .  .  .  .
        .  .  .  .  i  .  .  .  #  +  @  .  Y  H  @  .  .  N  @  .  '     S  .  6  b  O  .
? ? O  .  ? ? @  .  ? ? P  .  -  ? O  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  ? ? 5  .

解决方案 »

  1.   

    我信任FASTMM,它给我报的泄露我都找到了
      

  2.   

    我用fastmm也是,后来查实kbm的控件问题,懒得查,关掉了
      

  3.   

    FASTMM 比較好,有源代碼的三方控件也可以修改一下嘛,一般都是創建的東西沒有釋放而已.
      

  4.   

    楼主...那上面显示的信息告诉你的可不是第三方代码问题,而是你自己程序里的啊.404E0D [system.pas][System][@LStrSetLength][13156]
    532027 [Unit1.pas][Unit1][TForm1.VirtualStringTree1LoadNode][925] //看这行...
    ....你仔细看看你在处理LoadNode事件中的代码...
      

  5.   

    既然大家都说fastmm没误报,那俺慢慢改吧, 100多个啊 。。谢谢了。
      

  6.   

    procedure TForm1.VirtualStringTree1LoadNode(Sender: TBaseVirtualTree;
      Node: PVirtualNode; Stream: TStream);
    var
      Data: PNodeData;
      L: Integer;
    begin
        Data:=Sender.GetNodeData(Node);    Stream.Read (L, SizeOf (integer));
        SetLength   (Data.id, L );
        Stream.Read (Data.id [1], L);    Stream.Read (L, SizeOf (integer));
        SetLength   (Data.ifilename, L div 2);
        Stream.Read (Data.ifilename [1], L);    Data.ifilename := StringReplace (Data.ifilename, '.', '|', [rfReplaceAll ])
    end;
    好像没问题啊
      

  7.   

    确实比较奇怪SetLength一般不容易造成内存泄漏...但另两句看上去有点不对....
    从后面使用StringReplace来判断,你的Data.ifilename象是string类型..
    如果是STRING类型..下面这样用就是象缓冲溢出了....    SetLength   (Data.ifilename, L div 2);
        Stream.Read (Data.ifilename [1], L);//分配的空间只是L / 2..如果Data.ifilename是widestring...
    那SetLength(Data.ifilename,L div 2) 还是不对..至少也应该是
    SetLength(Data.ifilename,(L+1) div 2)另外...如果是widestring,SetLength便不会是用NewAnsiString来分配..
      

  8.   

    fastmm怎么检测内存问题啊?说说步骤,我也想检测一下。谢谢
      

  9.   

    下载安装http://fastmm.sourceforge.net
    在工程第一句添加fastmm,就行了。