Re: Pls HELP!- DataSet Inherited object not finalizing

From: Nicholas Paldino [.NET/C# MVP] (mvp_at_spam.guard.caspershouse.com)
Date: 02/15/05


Date: Tue, 15 Feb 2005 13:51:34 -0500

MuZZy,

    I am curious, what are you doing with the data set which requires
explicit management of memory in the finalizer and Dispose? Considering
that it should all be managed objects, you shouldn't have an issue. If you
just release the reference, let GC handle the memory.

-- 
               - Nicholas Paldino [.NET/C# MVP]
               - mvp@spam.guard.caspershouse.com
"MuZZy" <leyandrew@yahoo.com> wrote in message 
news:1ZmdnbjcXYP5oo_fRVn-qA@comcast.com...
> Willy Denoyette [MVP] wrote:
>> "MuZZy" <leyandrew@yahoo.com> wrote in message 
>> news:UeSdnXyHxYnttI_fRVn-gQ@comcast.com...
>>
>>>Hi All,
>>>I got a issue here and hope someone can help me:
>>
>>
>>>I guess my mistake is in the way i inherit from DataSet, but can't figure 
>>>out what exactly..
>>>
>>>Any ideas would be appreciated!!!
>>>
>>>Thank you,
>>>Andrey
>>
>>
>> This is the intended behavior as the Dataset ctor calls 
>> SuppressFinalize(this).
>> What exactly are you trying to achieve?
>>
>> Willy.
>
> Thank you for reply Willy!
>
> Damn, it that's true, i'm screwed!
> The thing is that we have the whole framework for our applications, and a 
> class inherited from DataSet is the core class there.
>
> I just came to the company and i was assigned the bug - memory leaks. I 
> found that it happens because objects of this class don't get finalized - 
> finalize function has a lot of memory cleaning.
>
> The worst thing is that i can't move all the stuff in Dispose(), as 
> Dispose() is not called for the object and to find all the places where to 
> put Dispose() would take months if not years...
>
> Can i re-register the inheritd class for the finalization?
>
> Thank you,
> Andrey 


Relevant Pages

  • RE: newbie: implementing destructors
    ... finalizer to your class means it takes longer to garbage collect (look up on ... have some 3rd party DLL which internally allocates a chunk of memory, ... environment is not aware of this memory so at no point will it clean up this ... let's call it Dispose for now which you can call ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: "using" vs "= null" and object lifetime
    ... IDispose, it doesn't mean that the object doesn't need to be GCed anymore. ... finalizer. ... is meant to be a safeguard if people don't call Dispose. ... The process of having the memory reclaimed ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: object.close() or object = null?
    ... BTW the garbage collector won't dispose objects, ... Assuming a correctly implemented finalizer, ... race conditions on the unmanaged resource. ... Same goes for any other unmanaged resource, except memory. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Pls HELP!- DataSet Inherited object not finalizing
    ... > to answer the original question, use GC.ReRegisterForFinalize, put ... >>explicit management of memory in the finalizer and Dispose? ... let GC handle the memory. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Pls HELP!- DataSet Inherited object not finalizing
    ... > explicit management of memory in the finalizer and Dispose? ... let GC handle the memory. ... >> The worst thing is that i can't move all the stuff in Dispose(), ...
    (microsoft.public.dotnet.languages.csharp)

Loading