Hi,
i have a problem when i use cwstrings together with threads on linux.
I made a simple program which create threads in an endless loop. Every thread only does a sleep(1) and then finish.
Without 'cwstrings' everything works fine.
But when i include 'cwstrings' the program eats more and more memory.
What is the problem ?
FPC 2.2.1 (I also tested with FPC 2.3.1) with Ubuntu 8.04
Alex
---------------------------------------------------------------------------------- threaddemo.lpr
---------------------------------------------------------------------------------- program threaddemo;
{$mode objfpc}{$H+}uses
cthreads,
cwstring,
SysUtils,
mythread;var
i: integer;
bTerm: boolean;
Thread: TmyThread;
begin
i := 0;
bTerm := false;
while not bTerm do
begin
Thread := TmyThread.create(true);
Thread.Resume;
Inc(i);
Sleep(1);
WriteLn('Thread #' + IntToStr(i));
end;
Halt(0);
end.---------------------------------------------------------------------------------- mythread.pas
---------------------------------------------------------------------------------- unit mythread;
interface
uses
Classes, SysUtils;
type
TmyThread = class(TThread)
private
public
Constructor Create(CreateSuspended : boolean);
procedure Execute; override;
end;
implementation{ TmyThread }
Constructor TmyThread.Create(CreateSuspended : boolean);
begin
inherited create(CreateSuspended);
FreeOnTerminate:=true;
end;
procedure TmyThread.Execute;
begin
sleep(1);
end;
end.