Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I realize in .NET that it garbage collects automatically when needed but I am still getting memory leaks. I have a program that acts as a Robot for the web and it gets links on pages and goes to all those pages and gets those links and so on. But my memory is getting used up little by little when I let it run for about an hour. Any ideas?

Thanks,

Tehon

Posted

im not sure but i dont think so. Im not sure again but if .NET is anything like java, all java object extend (originally) from the Object class, i guess .NET does this too (all object have GetType()). If you look at the Object memebers, it does not contain a dispose method.

 

If you look in the MSDN documentation, it tells you to impliment a dispose method if your own classes - i guess (AGAIN not sure) that most System.* object will impliment this.

Phil Price�

Visual Studio .NET 2003 Enterprise Edition

Microsoft Student Partner 2004

Microsoft Redmond, EMEA Intern 2004

  • *Experts*
Posted

GC.GetTotalMemory(True)

That call will force the garbage collector to perform a collection and returns the amount of heap space the program has allocated.

Posted
I've just added a dispose method to two of my RSS classes, RSSGet() and RSSFeed() (latter is a data holding class), and Disposing of RSSGet() just after use (it returns a RSSFeed) saved just under 2 meg of ram! So its definatly worth it.

Phil Price�

Visual Studio .NET 2003 Enterprise Edition

Microsoft Student Partner 2004

Microsoft Redmond, EMEA Intern 2004

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...