Circular object reference...

Z

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
 
J

Jon Skeet [C# MVP]

Zhenxin Li said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top