> when dataset/datatable will be disposed ?
>
> After calling Dispose(), when i access DataSet or DataTable, the object
> exists.
> Even after calling GC.Colect(), when i access them, the object and data
> exists.
The fact that you're able to access them means they can't be garbage
collected.
> Can anyone explain why & how.
>
> When i call dispose on dataset, will it automatically dispose all datatables
> that it contains ?
I don't believe Dispose does anything on a DataSet unless it's
contained in a site, or has a listener subscribed to the Disposed
event. It's basically got a Dispose method because it derives from
MarshalByValueComponent.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Niranjan - 31 May 2005 04:08 GMT
Thanks Jon,
I have huge datasets being used in my application (let say serviced
components & long running batch applications), how will i ensure that the
memory is cleaned esp with DataSets/DataTables.
thanks
niranjan
> > when dataset/datatable will be disposed ?
> >
[quoted text clipped - 15 lines]
> event. It's basically got a Dispose method because it derives from
> MarshalByValueComponent.
Sean Hederman - 31 May 2005 05:35 GMT
> Thanks Jon,
>
> I have huge datasets being used in my application (let say serviced
> components & long running batch applications), how will i ensure that the
> memory is cleaned esp with DataSets/DataTables.
Stop referencing them. If you can access them then they cannot be garbage
collected. Either let the variables holding them go out of scope, or set
them to null.