- 3,716,003 Users
- 2,242,928 Discussions
- 7,845,734 Comments
Forum Stats
Discussions
Categories
- 17 Data
- 362.2K Big Data Appliance
- 7 Data Science
- 1.6K Databases
- 476 General Database Discussions
- 3.7K Java and JavaScript in the Database
- 22 Multilingual Engine
- 487 MySQL Community Space
- 5 NoSQL Database
- 7.6K Oracle Database Express Edition (XE)
- 2.8K ORDS, SODA & JSON in the Database
- 417 SQLcl
- 42 SQL Developer Data Modeler
- 184.9K SQL & PL/SQL
- 21K SQL Developer
- 1.9K Development
- 3 Developer Projects
- 32 Programming Languages
- 135.1K Development Tools
- 9 DevOps
- 3K QA/Testing
- 256 Java
- 6 Java Learning Subscription
- 10 Database Connectivity
- 67 Java Community Process
- 1 Java 25
- 9 Java APIs
- 141.1K Java Development Tools
- 6 Java EE (Java Enterprise Edition)
- 153K Java Essentials
- 135 Java 8 Questions
- 86.2K Java Programming
- 270 Java Lambda MOOC
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 10 Java SE
- 13.8K Java Security
- 3 Java User Groups
- 22 JavaScript - Nashorn
- 18 Programs
- 125 LiveLabs
- 30 Workshops
- 9 Software
- 3 Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 3 Deutsche Oracle Community
- 11 Español
- 1.9K Japanese
- 2 Portuguese
Unmanaged Memory Leak with CLOB-columns when LegacyEntireLobFetch=0

Hi,
I'm new to this group, however I already searched for this topic but did not find any answer. But I wonder if we are the only ones that have this problem?
On customer site (and afterwards reproducable on developer machines) we observed a huge unmanaged memory leak with our application using Oracle 12 via ODP.NET.
We reduced the problem to a small test program - which shows that there might be a problem (bug) with selecting CLOB columns. Early versions of ODP.NET 12 may not have this problem - we observed it with ODP.NET 12.1.2 Release 4 and newer.
The unmanaged memory leak only arises if the parameter LegacyEntireLobFetch is set to 0 in our app.config. ODP.NET 11 does not have this problem, if I am right the default value for LegacyEntireLobFetch was 1 for ODP.NET 11 and changed to 0 for ODP.NET 12.
My question: Do we have a problem in our code? I found no way how to release the unmanaged memory for the CLOB. Or is this a bug in ODP.NET?
Many thanks in advance - i post the small test program below.
Kind regards
Carsten
-----
using System;
using System.Data;
using System.Threading;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace OracleTest
{
class Program
{
private static volatile bool Finish = false;
/*
* Used Table:
CREATE TABLE CLOBTEST
(
GUID RAW(17) NOT NULL,
TEXT VARCHAR2(20),
DESCRIPTION CLOB
);
INSERT INTO CLOBTEST
VALUES('ABDE95D8C13A1D419AE17812D6A7C6B2', 'Test', 'Description');
*/
static void Main()
{
Thread selectThread = new Thread(Select);
selectThread.Start();
bool c = true;
Console.WriteLine("g: collect garbage, q: quit");
while (c)
{
string s = Console.ReadLine();
if (s == "g")
{
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
Console.WriteLine("Collected garbage");
}
else if (s == "q")
{
c = false;
}
}
Finish = true;
selectThread.Join();
}
static void Select()
{
const string connectionString =
"Data Source=ORCL;User Id=DbUser;Password=DbPassword;Validate Connection=true;Max Pool Size=2";
while (!Finish)
{
using (OracleConnection connection = new OracleConnection(connectionString))
{
connection.Open();
using (OracleCommand command = connection.CreateCommand())
{
command.InitialLOBFetchSize = -1;
command.CommandText = "SELECT \"GUID\", \"TEXT\", \"DESCRIPTION\" FROM CLOBTEST";
// problem does not occur if CLOB column is not selected
//command.CommandText = "SELECT \"GUID\", \"TEXT\" FROM CLOBTEST";
using (OracleDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
object[] values = new object[reader.FieldCount];
reader.GetValues(values);
// try to dispose the CLOB explicitly - has no effect
//OracleClob clob = reader.GetOracleClob(2);
//clob?.Dispose();
//clob?.Close();
}
reader.Close();
}
command.Transaction?.Dispose();
}
connection.Close();
}
}
Console.WriteLine("Finished selecting");
}
}
}