By running ILDASM on System.Data.dll.

This is pure speculation, but I think a DataTable *must* keep a record of
every row it creates since it was last reset.  If it didn't, it would have
to re-align its indexes every time you created or deleted a DataRow.  That's
a pretty expensive operation, and the trade-off between memory and speed was
made in favour of speed.

If you cloned the table, the new copy's indexes will be clear, then you can
dispose of the original.  Should save you some memory.  Or maybe you need a
different approach altogether?

Jim

> -----Original Message-----
> From: MSTSE Developer [mailto:[EMAIL PROTECTED]]
> Sent: 26 April 2002 11:57
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] AW: Re: [DOTNET] memory leak when creating datarow
>
>
> The problem of calling simply the Clear methode is that everything is
> lost and not only the datarow i want to delete.
>
> Where have you found the information about the RecordManager?
>
> thanks
> Tobias
>
> > The DataTable uses a couple of internal classes to maintain
> > its indexes.
> > When you call NewRow(), the row is passed to an instance of
> > RecordManager,
> > which is basically a primary key for the table (regardless of
> > any key column
> > you specify).  Even if you don't add the DataRow to the table's Rows
> > collection, the RecordManager still tracks it.  The only way
> > I know of to
> > clear that reference is to call Clear() on the DataTable.
> > This resets its
> > indexes and clears out all the DataRow references.
> >
> > Jim
> >
>
> You can read messages from the DOTNET archive, unsubscribe
> from DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to