Is it compulsary to call Dispose() on custom objects Impementing IDisposable?


hi all

i have inherited code has many custom types/classes implement idisposable interface, during object life-time of these classes dispose method never gets called before object instances fall out of scope. mean resources these objects create/hold not cleaned up?

thanks in advance.

tryst

yes, gc collect memory , not resources. dispose free resources , gc takes care of memory. finalizers called teh gc , ensure unmanaged resources freed not want rely on because effictively closehandle , nothing more. no commit, no flush, ... performed when finalizers called gc not behaviour want when deal databases.

yours,
    alois kraus



.NET Framework  >  Common Language Runtime Internals and Architecture



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

RFC_ERROR_SYSTEM_FAILURE with SAP ECC 6 Unicode

C# System.Data.Common DbCommand and getting Datasets from Oracle