Andrew Brunner escribió:
What do you do with the Create, Execute and Destroy methods?  Meaning
are you declaring any Streams, Objects or Structures and not freeing
them?  Or is this problem replicated by just barely implementing
threads?


  
I have an application which uses Threads, memory usage by the application
does not diminish, but increases each time you create the threads and
finish, I think that is a problem with memory management in Free Pascal
2.2.2

OS: Ubuntu Linux
Lazarus 0.9.26

--

Lic. Liyuán García Caballero
      Especialista B en Ciencias Informáticas

Excelencia en Software
Desoft Ciego de Ávila.
Calle 2 y Joaquín de Agüero. Ciego de Ávila. Cuba.
 [email protected]
[email protected]
Ubuntu Linux
_______________________________________________
Lazarus mailing list
[email protected]
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


    

  
Check my Thread code:

procedure Tcheckonline.Execute;
begin
 sock.HTTPTunnelTimeout := 10000;
 query.FileName:=vpathdb;
 query.SQL:='SELECT * FROM computer WHERE name='''+vhost+''';';
 query.Open;
 if query.FieldByName('proxy').Value then
   begin
    if query.FieldByName('proxy_type').AsString = 'HTTP' then
       begin
        sock.HTTPTunnelIP := query.FieldByName('proxy_host').AsString;
        sock.HTTPTunnelPort := query.FieldByName('proxy_port').AsString;
        sock.HTTPTunnelUser := query.FieldByName('proxy_user').AsString;
        sock.HTTPTunnelPass := query.FieldByName('proxy_pass').AsString;
        sock.Connect(query.FieldByName('ip').AsString+
        ':'+query.FieldByName('port').AsString,'0');
       end;
    end else
    sock.Connect(query.FieldByName('ip').AsString,query.FieldByName('port').AsString);
    sock.SendString('noop;' + #10);
    if parse_proto('noop',sock.RecvPacket(500)) = 'ok' then
     begin
       vimg:=1;
       Synchronize(@putstatus);
     end else
     begin
      vimg:=0;
      Synchronize(@putstatus);
     end;
      sock.Free;
      query.Free;
      Terminate;
end;

procedure Tcheckonline.putstatus;
begin
 fprincipal.tvnode.Items[fprincipal.tvnode.Items.FindNodeWithText(vhost).Index].SelectedIndex:=vimg;
 fprincipal.tvnode.Items[fprincipal.tvnode.Items.FindNodeWithText(vhost).Index].ImageIndex:=vimg;
end;

function Tcheckonline.parse_proto(command, data: String): String;
var
 str : String;
 ini, fin : Integer;
begin
 ini := Pos(command,data);
 fin := Pos('=',data);
 str := copy(data,ini,fin-ini);
 if str = command then
  Begin
   ini := Pos('=',data)+1;
   fin := Pos(';',data);
   str := copy(data,ini,fin-ini);
   Result := str;
  end
end;

constructor Tcheckonline.create(CreateSuspended: Boolean; ahost, apathdb: String);
begin
 sock:= TTCPBlockSocket.Create;
 query := TSqlite3Dataset.Create(nil);
 vpathdb:=apathdb;
 vhost := ahost;
 FreeOnTerminate:=True;
 inherited Create(CreateSuspended);
end;

--
Firma

Lic. Liyuán García Caballero
      Especialista B en Ciencias Informáticas

Excelencia en Software
Desoft Ciego de Ávila.
Calle 2 y Joaquín de Agüero. Ciego de Ávila. Cuba.
e-mail: [email protected]
jabber: [email protected]
SO:
Ubuntu Linux
_______________________________________________
Lazarus mailing list
[email protected]
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to