Hi there everyone,
I'm working on rewriting an application I wrote a while ago.
{ TParentThread }
TParentThread = class(TThread)
private
{ private decelarations }
// a critical section
FCriticalSection: TCriticalSection;
protected
{ protected decelarations }
procedure Execute; override;
public
{ public decelarations }
// the TCP client
FTCPClient: TIdTCPClient;
// constructor and destructor
constructor Create(ATCPClient: TIdTCPClient);
destructor Destroy; override;
// enter critical section
procedure Lock;
// leave critical section
procedure Unlock;
end;
constructor TParentThread.Create(ATCPClient: TIdTCPClient);
begin
// set reference to the TCP client
FTCPClient := ATCPClient;
// create a critical section instance
FCriticalSection := TCriticalSection.Create;
inherited Create(True);
end;
{ TThreadVilles }
TThreadVilles = class(TParentThread)
private
{ private declarations }
FOnVille: TFillComboBoxEx;
procedure DoFillComboBoxEx;
protected
{ protected declarations }
procedure Execute; override;
public
{ public declarations }
// constructor and destructor
constructor Create(ATCPClient: TIdTCPClient);
destructor Destroy; override;
// property
property OnVille: TFillComboBoxEx read FOnVille write FOnVille;
end;
constructor TThreadVilles.Create(ATCPClient: TIdTCPClient);
begin
inherited;
Create(ATCPClient);
end;
procedure TfrmVilles.FormShow(Sender: TObject);
begin
// Create the thread
DataThread := TThreadVilles.Create(FTCPClient); <-- The error occurs here
//
DataThread.Start;
//
DataThread.DoFillComboboxEx;
end;
The code above is part of the program & I keep getting an error on the line where the thread is created which says Thread creation error: insufficient space to treat this command. See attachment. I've never had such a problem before. The message is rather confusing because I have 4GB of RAM.
I would appreciate the insight of the community about how to get round this problem.
Thanks,
JD