谢谢各位的观注!!
我的程序(多次)执行这句。  
    Result:= NextFindNext(fNextText, '<', fNextPos, tag1) and NextFindNext(fNextText, '>', tag1, tag2);
     
内存狂增,且释放不了,请问名位大侠这应该怎么处理???
function NextFindNext(const Nexttext:string; ch:char; startfrom:Integer; var pos:Integer):Boolean;
begin
  pos:= startfrom;
  while (pos<=Length(Nexttext)) and (Nexttext[pos]<>ch) do Inc(pos);
  Result:= (Nexttext[pos]=ch);
end;

解决方案 »

  1.   

    如果把这句
    while (pos<=Length(Nexttext)) and (Nexttext[pos]<>ch) do Inc(pos);
    给去掉,内存可以释放掉?
      

  2.   

    function NextFindNext(const Nexttext:string; ch:char; startfrom:Integer):Boolean;
    var s:string;
    begin
      s:=copy(nexttext,startfrom,length(nexttext)-startfrom+1);
      result:=( pos(ch,s)=0);
    end;
      

  3.   

    不会是死循环,
    单步调试不报错, 
    如果把这句
    while (pos<=Length(Nexttext)) and (Nexttext[pos]<>ch) do Inc(pos);
    给去掉,内存可以释放掉
      

  4.   

    死循环看起来不像.
    while (pos<=Length(Nexttext)) and (Nexttext[pos]<>ch) do Inc(pos);
      Result:= (Nexttext[pos]=ch);
    // 因为有 pos这个条件限制....是不是你这个 Nexttext函数的问题??
      

  5.   

    TO
    死循环看起来不像.
    while (pos<=Length(Nexttext)) and (Nexttext[pos]<>ch) do Inc(pos);
      Result:= (Nexttext[pos]=ch);
    // 因为有 pos这个条件限制....是不是你这个 Nexttext函数的问题??
    Nexttext不是函数,是一个Nexttext:string
      

  6.   

    在这里*inc(pos)*,var 传的是一个指针指针递增应该就会增加内存吧?
    其实看你的程序应该不用var修饰。
      

  7.   

    不对。应该不会是指针递增。还是指针的内容递增。不过您可以去掉var试一试