Scenario
- Lets say that I've decided I really need to call GC.Collect();
- What do I need to do to ensure that an object is prepared to be garbage collected appropriately before I actually call this method?
- Would assigning null to all properties of the object be enough? Or just assigning null to the object itself?
If you really need to know why.....
- I have a distributed application in WCF that sends a DataContract over the wire every few seconds, containing 8 Dictionaries as DataMembers.
- This is a lot of data and when it comes into the Client-side interface, a whole new DataContract object is created and the memory usage of the application is growing so big that I'm getting OutOfMemory Exceptions.
Thanks
EDIT
Thanks for all the comments and answers, it seems that everyone shares the same opinion.
- What I cannot understand is how I can possibly dispose correctly because the connection is open constantly.
- Once I've copied the data over from the incoming object, I don't need the object anymore, so would simply implementing IDisposable on that DataContract object be enough?
- My original problem is here - Distributed OutOfMemory Exceptions