Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / December 2004

Tip: Looking for answers? Try searching our database.

Memory Leak?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robert Reineri - 30 Dec 2004 20:00 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.