Finalizer Queue
Finalizer Queue
I'm hunting down a memory issue with one of our applications that uses devart dotconnect for oracle and I need some assistance. I'm using windbg to show me what's going on with the memory on the servers and I pulled up the finalizer queue and there are thousands of objects ready for finalization. Most of them are Devart.Data.Oracle.OracleConnection. Is this expected? We are calling close() and dispose() on the OracleConnection object, so why would they still need to be finalized? Shouldn't the finalizer be suppressed if we dispose of the the oracleConnection object?
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Finalizer Queue
Thank you for the provided information. We will investigate it and post here about the results as soon as possible.
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Finalizer Queue
OracleConnection is inherited from the System.ComponentModel.Component, which has a finalizer, and thus, is included to the finalizer queue.
The Dispose() method implementation of the Component class calls GC.SuppressFinalize(this), which excludes the component from the finalizer queue. Thus, if you call only Close() for OracleConnection, and don’t call Dispose(), in this case OracleConnection will stay in the finalizer queue. And if you call Dispose(), it will be excluded from the finalizer queue.
Probably there is a place in your code, where the Close method is called, and Dispose is not. Please check whether the Dispose method is called for every connection in your code.
The Dispose() method implementation of the Component class calls GC.SuppressFinalize(this), which excludes the component from the finalizer queue. Thus, if you call only Close() for OracleConnection, and don’t call Dispose(), in this case OracleConnection will stay in the finalizer queue. And if you call Dispose(), it will be excluded from the finalizer queue.
Probably there is a place in your code, where the Close method is called, and Dispose is not. Please check whether the Dispose method is called for every connection in your code.
Re: Finalizer Queue
Thank you for the information. I'll look through our code to make sure we are closing and disposing the connections properly.