Guys
I'm hoping one of you can help me with this perculiar Thread Creation error and lack of free storage error? I have Googled it for several days, found one partial mention on this forum (as linked above) but all the suggestions seem to relate to changing computer settings and registry entries, which can't be right. I've also done some further code refinements over the last few evenings, as Taazz advised, by looking for memory leaks using HeapTrace. I noticed from that, that I wasn't freeing the file stream handle (fs.free), for one thing. I also noticed I was still calling the filename string from outside the Execute method. I also noticed that my "big file" loop was updating Form1 directly, still. So I've removed that for now. And I'm using Dispose(PInfoData(Data)); instead of Free(Data). And I have specifically set the stack size in the project options to 100000, as I read that was one solution on the Lazarus bug tracker.
And yet, I still get the error.
I was hoping one of you might download the demo project, and see if you get the same error by selecting a folder with quite a lot of files in it, and seeing if you get it as well? You might not the first time round, or the second, but on my PC, I usually get it whenever I point it at a file with more than about 50 files in it. If you do get the error, are you able to see where the problem might be, and if you are, can you explain to me how you find it for future reference, because using the debugger is not helping me and I don't know how to use the stacktrace thingy? The error is thrown by
constructor TFileHashingWorkerThread.Create(aFilename : string;const FinishEvent:TDataEvent);
begin
inherited Create(False); <------- This is what throws the error
...
The full project is zipped here :
https://my.pcloud.com/publink/show?code=XZvaiaZz8YjMOUg8fXaiGTorzs9BpExWCXV created with latest version of Lazarus and FPC.
In order to compile it, you'll need to use the Package Manager to add the HashLib4Pascal library (lpk package file comes with it), which is included in the folder, under Packages\FPC.
Any help appreciated. I just can't seem to debug what is causing the error.
[/code]