Hello All,
I have a simple little prototype application that seems to be consuming
resources and memory, and when the application stops processing, no cleanup
seems to occur. Basically, what happens is this:
1. A data file is created in a directory, and a FileSystemWatcher fires an
event that I catch.
2. In the event handler, I use the ThreadPool.QueueUserWorkItem to process
the file. The file is XML, with a bunch of records in it. Basically, I
scan through the file and process each record.
3. The thread finishes processing the file. At this point, it is a
prototype, so all the thread is really doing is creating one object for each
record in
the file. The object has a bunch of properties, each one representing
the value of an element in the a single XML record. So if there are
100 "Items" in the Xml file, there will be 100 objects created. No
reference is being held to these objects. They are simple newed up nd loaded
with the parsed data.
I hold no references to the thread in my main application, yet everytime I
drop another file in the directory to start the processing, the memory usage
continues to grow, and is never released. I am making sure to explicitly
release all object references, there are no circular references that I can
find.I am closing all files.
When a thread is finished processing, doesn't it "go away" and return to the
thread pool? At this point, I would think any objects it had created would
be garbage collected as well.
Sorry if this is a newbie topic, but I'm rather new to multithreading, and
would like to do this right. I hope my description above is clear enough.
Please respond via newsgroup. Thanks for any help in advance.
Robert
Richard A. Lowe - 31 Dec 2004 09:29 GMT
This is a common question, you can google many answers to:
http://tech-geeks.org/tiny.php?url=2573
or original URL (watch for wrapping):
http://groups-beta.google.com/groups?hl=en&ie=UTF-8&safe=off&num=10&q=reduce+mem
ory+usage+group%3Amicrosoft.public.dotnet.*&safe=off

Signature
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
> Hello All,
>
[quoted text clipped - 37 lines]
>
> Robert