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 / April 2005

Tip: Looking for answers? Try searching our database.

Cleaning Up Memory

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
arvind - 05 Apr 2005 14:39 GMT
Hi

I have a .NET windows App in which I load Assemblies using Assembly.Load
into the current Application Domain, Search for Types which implement certain
interfaces and then create Instance of each of these types and call some
methods on eacn Type. I am making use of Activator.CreateInstance(type)
method to create instances of these types. Everything works fine.. untill u
know that each time this code fires, memory utilization increases
incrementaly. For Ex. If the Windows App took 30MB. each time this code
executes, the memory utilization goes like this 40MB, 50MB, 60MB (approximate
values).

How should I take take of cleaning up memory? .Also, since I make use of the
Activator Class to create Instances does it mean the objects that get created
are contained in the App Domain? In which case the only way I can think of
achieving this is to create a New App Domain and Unload it.

Please advice.

Signature

arvind

john conwell - 05 Apr 2005 17:01 GMT
Yep, you guessed it.  When ever you load an assembly into your AppDomain,
your stuck with that assembly for the life of the AppDomain.  Your only
choice, if you want to keep the memmory consumption to a miminum, is to
create a second AppDomain and load your extra assemblies into there.  then
when you are finished with the assembly, just drop the AppDomain.

> Hi
>
[quoted text clipped - 14 lines]
>
> Please advice.

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.