Hi David
How many items are you adding to the list before it fails? Are you exceeding
the capacity of the list?
Are you overwriting the memory address of you string list somewhere else
using pointer variables?
Do you have range checking switched on in Project -> Options -> Compiler tab
Its not clear to me, when the global string list is created. Each time a new
thread is created?
Also agree with others regarding making your stringlist a private field in
your thread class. From what I have read, threadvar should not be used with
pointer variables. I suppose TStringlist counts as a pointer variable.
Todd.
----- Original Message -----
From: "David McNeill" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Thursday, September 11, 2003 11:56 AM
Subject: [DUG]: TStringList or Memory error.
> This is a nasty one I can't get to the bottom of, so any clues or tips
> would be appreciated.
>
> Fundamental problem: Access Violation on accessing a stringlist.
>
> Situation: Database update process iterates 700+ times, doing the same
> thing, before tipping over.
>
> It's like the tstringlist "disappears" for some unknown reason.
>
> I use the same method in thousands of other lines, and never fails.
>
> Breaks on two servers at the customers place, but not on my dev server.
>
>
> Multi-threaded tray app, using Indy http server.
>
>
> Snips:
>
>
> Main.pas
> threadvar
> tlResult:TStringlist;
>
> Main.pas
> Procedure TimerExecute;
> Tlresult:=tstringlist.create;
>
> DoDatabaseProcessing;
>
>
> Database.pas
> Procedure DoDatabaseProcessing;
> While not database.eof do begin
> .. hundreds of lines
> tlresult.add('Ok: Processed item '+IntToStr(RecordNo)); // access
> violation
> end;
>
>
>
>
> I tried descending tstringlist and putting in a log on BeforeDestruction
> , but it does not appear the stringlist is explicitly being destroyed.
>
> It is more like something else is clobbering it's memory, and it is
> "disappearing" at some point.
>
> Any help appreciated.
>
>
> David McNeill
> McPond eCommerce Software
> [EMAIL PROTECTED]
> Buchanan Road
> Franklin
> New Zealand
> Phone 09 292 7212
>
>
>
>
>
>
>
>
>
> --------------------------------------------------------------------------
-
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/