Quality Is Our Solution
QIOS Portal
|
Extranet
Home
Qios.DevSuite
Downloads
Samples & Documentation
Servicedesk
QIOS
Controls
Features
Requirements
Licensing
Buy
Screenshots
Download
Resellers
Contact
Support policy
Extranet
Documents
Samples
Version information
Memory Management
Design Gallery
Memory management notes
About collections
The .NET Framework implements dynamic arrays like Collections with a static-sized array and a size identifier. If an item is removed from this collection, the size identifier is lowered. The static-sized array can still contain a reference to the object, therefore it can still show the item in a memory profiler. An example of this is Form.OwnedForms. Even if you remove a Form from this collection, the collection still has a reference to the Form and the Form will not get disposed yet.
Form.Owner
When setting the Owner property of a Form, it will add a strong reference to the Form in the Owner. Because of this, the Form will not be cleaned up when all references are lost. Dispose the Form manually or reset the Owner property when you are done with it. Calling the Close method will also result in a Dispose(), so closing the form is also a solution.
Links
Here are some interesting external links about memory management:
Simulating "Weak Delegates" in the CLR
A solution for creating Weak Delegates.
- Greg Schechter's Blog
Simulating Weak Delegates for EventHandler-like Delegates
An attempt to create an simpler solution then the one from Greg Schechter's blog.
- Ian Griffiths Blog
WeakReference and InvalidOperationException in the finalizer
Why does my WeakReference throw an InvalidOperationException when I use it from my finalizer?
- Brad Abrams Blog
WeakReference class
The (Mono) sourcecode of the WeakReference class.
- Koders.com
Qios.DevSuite.MemoryPack
Updated Version: 2006-09-07
Memory Management
Memory management
Introduction about automatic memory management and its problems.
More information
Publishing and consuming
Explains how to publish and consume events using the QWeakEvent structure to prevent controls from being ignored by the garbage collector.
More information
QWeakMessageFilter and
QWeakReferenceCollection
Shows how to create a collection of weak references and a weak IMessageFilter implementation.
More information
Other notes and links
A few other notes and links about memory management
More information
Qios.DevSuite.MemoryPack
Screenshots
Some MemoryPack screenshots that illustrate the difference when using our technique
More information
Download
Qios.DevSuite.MemoryPack
Download the
free
and
opensource
library & sample application that shows the difference between normal event handling and using the QWeakEvent structure.
Proceed to the download
Copyright
|
Disclaimer
|
User agreement