Home All Groups Group Topic Archive Search About

Circular object reference...

Author
9 Nov 2006 4:23 AM
Zhenxin Li
I'm writing a server service which will process large amount of data. The
internal data structure contains complex circular object references. I
notice out-of-memory after the service runs for some time.

When I use memory profiler tool to view the whole memory map, I find those
circular referenced objects are not freed but the root reference where the
objects are allocated has been set to null.

Is .net garbage collector able to handle complex circular object reference
correctly? Or I have to dereference all the circular references myself?

Thanks!
zxli

Author
9 Nov 2006 7:07 AM
Jon Skeet [C# MVP]
Zhenxin Li <imz***@hotmail.com> wrote:
> I'm writing a server service which will process large amount of data. The
> internal data structure contains complex circular object references. I
> notice out-of-memory after the service runs for some time.
>
> When I use memory profiler tool to view the whole memory map, I find those
> circular referenced objects are not freed but the root reference where the
> objects are allocated has been set to null.
>
> Is .net garbage collector able to handle complex circular object reference
> correctly? Or I have to dereference all the circular references myself?

Yes, the GC can handle circular references. It sounds like you've
probably got a reference somewhere else.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

AddThis Social Bookmark Button