We have an event class which has a reference of a MsgBody class:
public class StatusEvent
{
MsgBody msgBody;
public StatusEvent(MsgBody body)
{
msgBody = body;
}
....
}
public class MsgBody
{
string s1;
string s2;
.....
}
MsgBody class is ONLY used by StatusEvent. No other place a MsgBody is refered. When a StatusEvent instance is created, a MsgBody instance will be created. When a StatusEvent object is ready for cleanup, a MsgBody object will be safe to be cleanup.
But the result is the MsgBody cleanup is way behind the StatusEvent. From one profiler result, I found there ware only 43 Live instances of StatusEvent but there were 9,940 instances of MsgBody!
Is there a way to link them together and make GC cleanup MsgBody when it wipe StatusEvent away?
thanks,