Hi there. I seem to be having a similar problem concerning threads and freeing objects. I narrowed down the problem by commenting out code, and it seems to be occuring when I try to free a TClientDataSet I create in the thread's constructor.
I tried creating the TClientDataSet both with owner=nil and owner=application but the problem persists either way.
The strange thing is that the access violation doesn't happen in every instance of the thread which I create and free, but only starts happening when I reach a certain thread count (usually when i exceed 8 threads).
When I remove the line where I try to free the TClientDataSet, the access violation disappears, but I'd really like to free the TClientDataSet in order to avoid taking up memory and perhaps creating memory leaks.
I'd really appreciate any insight and suggestions you may have as to why this is happening and what I can do to solve this problem.
I've never used a TClientDataset in a thread, but maybe it would help if you set the variable to nil after you free it, so no access violations will happen even if it might try to free multiple times.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.