HighTechTalks DotNet Forums  

Memory Management

Dotnet Academic General Discussions microsoft.public.dotnet.academic


Discuss Memory Management in the Dotnet Academic General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Manish Parikh
 
Posts: n/a

Default Memory Management - 09-05-2003 , 07:41 AM






Hi All

A Show Stopper problem in our application

we have a DLL which exposes some objects collections in terms of get and
set properties. The objects have very heavy memory footprints (beyond 2gb)
we want to have the funcionality that if the memory usage goes beyond a
certain threshold limit we persist the content of these objects in hard disk
and destroy them to free up the memory.


Problem is, the instance to these objects will be created in the
Applications using this component. Can we free up the memory by destroying
these objects even if they are being refrenced from the client application?


Any Leads / Suggestions are most welcome

Regards,

Manish



Reply With Quote
  #2  
Old   
Jay B. Harlow [MVP - Outlook]
 
Posts: n/a

Default Re: Memory Management - 09-05-2003 , 10:07 AM






Manish,
I would consider using a variation the Lazy Load Pattern with Weak
References (System.WeakReference).

http://www.martinfowler.com/eaaCatalog/lazyLoad.html

http://msdn.microsoft.com/library/de...ClassTopic.asp

There are both short & long weak references. Not sure which will work better
for you.

My concern is: Does the app create these objects or just consume? Generally
a Weak Reference is used to allow the object to be discarded at the
discretion of the GC, if the object is dirty you do not want the object
discarded. Of course you could be 'check points' in your object, the app
builds part of the object, calls a check point to save, builds some more,
save some more...

Hope this helps
Jay

"Manish Parikh" <parikh__manish (AT) hotmail (DOT) com> wrote

Quote:
Hi All

A Show Stopper problem in our application

we have a DLL which exposes some objects collections in terms of get and
set properties. The objects have very heavy memory footprints (beyond 2gb)
we want to have the funcionality that if the memory usage goes beyond a
certain threshold limit we persist the content of these objects in hard
disk
and destroy them to free up the memory.


Problem is, the instance to these objects will be created in the
Applications using this component. Can we free up the memory by destroying
these objects even if they are being refrenced from the client
application?


Any Leads / Suggestions are most welcome

Regards,

Manish





Reply With Quote
  #3  
Old   
Fergus Cooney
 
Posts: n/a

Default Re: Memory Management - 09-06-2003 , 06:11 PM



Hi Manish,

If you want to know more about what WeakReferences are, the following two-part article gives a very good explanation of the
Garbage Collector, including WeakReferences.

http://msdn.microsoft.com/msdnmag/issues/1100/gci/
http://msdn.microsoft.com/msdnmag/issues/1200/GCI2/

Regards,
Fergus

[Taken from your Object Life Cycle post in csharp, Jay. Thanks - it was a useful read.]




Reply With Quote
  #4  
Old   
Fergus Cooney
 
Posts: n/a

Default Re: Memory Management - 09-06-2003 , 06:14 PM



Hi Manish,

Quote:
| Can we free up the memory by destroying these
| objects even if they are being refrenced from the
| client application?
I would certainly hope not. At least not without informing the client application in some way. Is there anyway that your apps
can negotiate the destruction of an object?

Regards,
Fergus




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.