Re: [fpc-pascal] Problem with threads and cwstrings

2008-06-18 Thread Jonas Maebe


On 18 Jun 2008, at 07:50, Alexander Bauer wrote:


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 ?


Please submit a bug report.


Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Problem with threads and cwstrings

2008-06-17 Thread Alexander Bauer

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.




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal