Finalizer Queue

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
dhoenig
Posts: 16
Joined: Tue 20 Jul 2010 20:33

Finalizer Queue

Post by dhoenig » Mon 20 Feb 2017 20:01

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?

Pinturiccio
Devart Team
Posts: 2138
Joined: Wed 02 Nov 2011 09:44

Re: Finalizer Queue

Post by Pinturiccio » Thu 23 Feb 2017 16:28

Thank you for the provided information. We will investigate it and post here about the results as soon as possible.

dhoenig
Posts: 16
Joined: Tue 20 Jul 2010 20:33

Re: Finalizer Queue

Post by dhoenig » Thu 09 Mar 2017 19:02

Any updates on this?

Pinturiccio
Devart Team
Posts: 2138
Joined: Wed 02 Nov 2011 09:44

Re: Finalizer Queue

Post by Pinturiccio » Tue 14 Mar 2017 14:26

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.

dhoenig
Posts: 16
Joined: Tue 20 Jul 2010 20:33

Re: Finalizer Queue

Post by dhoenig » Tue 14 Mar 2017 14:47

Thank you for the information. I'll look through our code to make sure we are closing and disposing the connections properly.

Post Reply