OracleBulkCopy have memory leak  if BatchSize is less than record's count.

OracleBulkCopy::WriteToServer(IDataReader reader) have memory leak if BatchSize property is less than amount of record which were retrieved from IDataReader.
We know workaround for that, but when this problem will be fixed?
Code source at the bottom:
*****************File::Program.cs*****************
using System;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using Oracle.DataAccess.Client;
namespace WindowsApplication
static class Program
private static DataTable _testTable = new DataTable("TestData");
private static int _batchSize = 10000;
private static int _totalRecordForTest = 100000;
private static int _bulkTimeOut = 600;
private static string _targetConnectionString;
private static string _targetTableName;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
_testTable.ReadXmlSchema("tmp.data.schema");
_testTable.ReadXml("tmp.data");
_targetConnectionString = ConfigurationManager.AppSettings["targetConnectionString"];
_targetTableName = ConfigurationManager.AppSettings["targetTableName"];
_batchSize = int.Parse(ConfigurationManager.AppSettings["batchSize"]);
_totalRecordForTest = int.Parse(ConfigurationManager.AppSettings["totalRecordForTest"]);
_bulkTimeOut = int.Parse(ConfigurationManager.AppSettings["bulkTimeOut"]);
PerformCorrectTest();
Console.WriteLine("Do you want to perform memory leak test?(If no then click cancel key)");
if (Console.ReadKey().Key != ConsoleKey.Escape)
PerformMemoryLeakTest();
Console.ReadKey();
_testTable =null;
public static void PerformCorrectTest()
Console.WriteLine("Managed memory usage: {0}, unmanaged: {1}", GC.GetTotalMemory(false),
Process.GetCurrentProcess().WorkingSet64);
using (VirtualSourceReader wrapper = new VirtualSourceReader(new DataTableReader(_testTable), batchSize, totalRecordForTest))
wrapper.RowsCopied += RowsCopied;
using (OracleConnection targetConnection = new OracleConnection(_targetConnectionString))
targetConnection.Open();
Console.WriteLine("Bulk insert started at {0}", DateTime.Now);
OracleBulkCopy bc = null;
try
bc = new OracleBulkCopy(targetConnection)
DestinationTableName = _targetTableName,
BulkCopyTimeout = _bulkTimeOut,
BatchSize = _batchSize
do
bc.WriteToServer(wrapper);
} while (wrapper.ResetState());
finally
if (null != bc)
bc.Close();
bc.Dispose();
targetConnection.Clone();
Console.WriteLine("Bulk insert completed at {0}", DateTime.Now);
wrapper.Close();
Console.WriteLine("Managed memory usage: {0}, unmanaged: {1}", GC.GetTotalMemory(false),
Process.GetCurrentProcess().WorkingSet64);
public static void PerformMemoryLeakTest()
Console.WriteLine("Managed memory usage: {0}, unmanaged: {1}", GC.GetTotalMemory(false),
Process.GetCurrentProcess().WorkingSet64);
using (VirtualSourceReader wrapper = new VirtualSourceReader(new DataTableReader(_testTable), totalRecordForTest, totalRecordForTest))
using (OracleConnection targetConnection = new OracleConnection(_targetConnectionString))
targetConnection.Open();
Console.WriteLine("Bulk insert started at {0}", DateTime.Now);
OracleBulkCopy bc = null;
try
bc = new OracleBulkCopy(targetConnection)
DestinationTableName = _targetTableName,
BulkCopyTimeout = _bulkTimeOut,
BatchSize = _batchSize,
NotifyAfter = _batchSize,
bc.OracleRowsCopied += OracleRowsCopied;
bc.WriteToServer(wrapper);
finally
if (null != bc)
bc.Close();
bc.Dispose();
targetConnection.Clone();
Console.WriteLine("Bulk insert completed at {0}", DateTime.Now);
wrapper.Close();
Console.WriteLine("Managed memory usage: {0}, unmanaged: {1}", GC.GetTotalMemory(false),
Process.GetCurrentProcess().WorkingSet64);
private static void RowsCopied(object sender, long eventArgs)
Console.WriteLine("Row Processed {0}. Current time is {1}", eventArgs, DateTime.Now);
private static void OracleRowsCopied(object sender, OracleRowsCopiedEventArgs eventArgs)
RowsCopied(sender, eventArgs.RowsCopied);
*****************File::SourceDataReaderWrap.cs*****************
using System;
using System.Collections.Generic;
using System.Data;
using Oracle.DataAccess.Client;
namespace WindowsFormsApplication1
public delegate void OnRowProcessed(object sender, long rowCount);
public class SourceDataReaderWrap:IDataReader
protected IDataReader _originalReader;
protected readonly int _batchSize;
protected int _currentSessionRows;
protected long _rowCount;
public event OnRowProcessed RowsCopied;
public SourceDataReaderWrap(IDataReader originalReader, int batchSize)
_originalReader = originalReader;
_batchSize = batchSize;
_rowCount = 0;
#region Implementation of IDisposable
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
/// <filterpriority>2</filterpriority>
public void Dispose()
_originalReader.Dispose();
_originalReader = null;
if (RowsCopied != null)
foreach (OnRowProcessed @delegate in new List<Delegate>(RowsCopied.GetInvocationList()))
RowsCopied -= @delegate;
#endregion
#region Implementation of IDataRecord
/// <summary>
/// Gets the name for the field to find.
/// </summary>
/// <returns>
/// The name of the field or the empty string (""), if there is no value to return.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public string GetName(int i)
return _originalReader.GetName(i);
/// <summary>
/// Gets the data type information for the specified field.
/// </summary>
/// <returns>
/// The data type information for the specified field.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public string GetDataTypeName(int i)
return _originalReader.GetDataTypeName(i);
/// <summary>
/// Gets the <see cref="T:System.Type"/> information corresponding to the type of <see cref="T:System.Object"/> that would be returned from <see cref="M:System.Data.IDataRecord.GetValue(System.Int32)"/>.
/// </summary>
/// <returns>
/// The <see cref="T:System.Type"/> information corresponding to the type of <see cref="T:System.Object"/> that would be returned from <see cref="M:System.Data.IDataRecord.GetValue(System.Int32)"/>.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public Type GetFieldType(int i)
return _originalReader.GetFieldType(i);
/// <summary>
/// Return the value of the specified field.
/// </summary>
/// <returns>
/// The <see cref="T:System.Object"/> which will contain the field value upon return.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public object GetValue(int i)
return _originalReader.GetValue(i);
/// <summary>
/// Gets all the attribute fields in the collection for the current record.
/// </summary>
/// <returns>
/// The number of instances of <see cref="T:System.Object"/> in the array.
/// </returns>
/// <param name="values">An array of <see cref="T:System.Object"/> to copy the attribute fields into.
/// </param><filterpriority>2</filterpriority>
public int GetValues(object[] values)
return _originalReader.GetValues(values);
/// <summary>
/// Return the index of the named field.
/// </summary>
/// <returns>
/// The index of the named field.
/// </returns>
/// <param name="name">The name of the field to find.
/// </param><filterpriority>2</filterpriority>
public int GetOrdinal(string name)
return _originalReader.GetOrdinal(name);
/// <summary>
/// Gets the value of the specified column as a Boolean.
/// </summary>
/// <returns>
/// The value of the column.
/// </returns>
/// <param name="i">The zero-based column ordinal.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public bool GetBoolean(int i)
return _originalReader.GetBoolean(i);
/// <summary>
/// Gets the 8-bit unsigned integer value of the specified column.
/// </summary>
/// <returns>
/// The 8-bit unsigned integer value of the specified column.
/// </returns>
/// <param name="i">The zero-based column ordinal.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public byte GetByte(int i)
return _originalReader.GetByte(i);
/// <summary>
/// Reads a stream of bytes from the specified column offset into the buffer as an array, starting at the given buffer offset.
/// </summary>
/// <returns>
/// The actual number of bytes read.
/// </returns>
/// <param name="i">The zero-based column ordinal.
/// </param><param name="fieldOffset">The index within the field from which to start the read operation.
/// </param><param name="buffer">The buffer into which to read the stream of bytes.
/// </param><param name="bufferoffset">The index for <paramref name="buffer"/> to start the read operation.
/// </param><param name="length">The number of bytes to read.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
return _originalReader.GetBytes(i, fieldOffset, buffer, bufferoffset, length);
/// <summary>
/// Gets the character value of the specified column.
/// </summary>
/// <returns>
/// The character value of the specified column.
/// </returns>
/// <param name="i">The zero-based column ordinal.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public char GetChar(int i)
return _originalReader.GetChar(i);
/// <summary>
/// Reads a stream of characters from the specified column offset into the buffer as an array, starting at the given buffer offset.
/// </summary>
/// <returns>
/// The actual number of characters read.
/// </returns>
/// <param name="i">The zero-based column ordinal.
/// </param><param name="fieldoffset">The index within the row from which to start the read operation.
/// </param><param name="buffer">The buffer into which to read the stream of bytes.
/// </param><param name="bufferoffset">The index for <paramref name="buffer"/> to start the read operation.
/// </param><param name="length">The number of bytes to read.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
return _originalReader.GetChars(i, fieldoffset, buffer, bufferoffset, length);
/// <summary>
/// Returns the GUID value of the specified field.
/// </summary>
/// <returns>
/// The GUID value of the specified field.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public Guid GetGuid(int i)
return _originalReader.GetGuid(i);
/// <summary>
/// Gets the 16-bit signed integer value of the specified field.
/// </summary>
/// <returns>
/// The 16-bit signed integer value of the specified field.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public short GetInt16(int i)
return _originalReader.GetInt16(i);
/// <summary>
/// Gets the 32-bit signed integer value of the specified field.
/// </summary>
/// <returns>
/// The 32-bit signed integer value of the specified field.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public int GetInt32(int i)
return _originalReader.GetInt32(i);
/// <summary>
/// Gets the 64-bit signed integer value of the specified field.
/// </summary>
/// <returns>
/// The 64-bit signed integer value of the specified field.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public long GetInt64(int i)
return _originalReader.GetInt64(i);
/// <summary>
/// Gets the single-precision floating point number of the specified field.
/// </summary>
/// <returns>
/// The single-precision floating point number of the specified field.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public float GetFloat(int i)
return _originalReader.GetFloat(i);
/// <summary>
/// Gets the double-precision floating point number of the specified field.
/// </summary>
/// <returns>
/// The double-precision floating point number of the specified field.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public double GetDouble(int i)
return _originalReader.GetDouble(i);
/// <summary>
/// Gets the string value of the specified field.
/// </summary>
/// <returns>
/// The string value of the specified field.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public string GetString(int i)
return _originalReader.GetString(i);
/// <summary>
/// Gets the fixed-position numeric value of the specified field.
/// </summary>
/// <returns>
/// The fixed-position numeric value of the specified field.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public decimal GetDecimal(int i)
return _originalReader.GetDecimal(i);
/// <summary>
/// Gets the date and time data value of the specified field.
/// </summary>
/// <returns>
/// The date and time data value of the specified field.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public DateTime GetDateTime(int i)
return _originalReader.GetDateTime(i);
/// <summary>
/// Returns an <see cref="T:System.Data.IDataReader"/> for the specified column ordinal.
/// </summary>
/// <returns>
/// An <see cref="T:System.Data.IDataReader"/>.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public IDataReader GetData(int i)
return _originalReader.GetData(i);
/// <summary>
/// Return whether the specified field is set to null.
/// </summary>
/// <returns>
/// true if the specified field is set to null; otherwise, false.
/// </returns>
/// <param name="i">The index of the field to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
public bool IsDBNull(int i)
return _originalReader.IsDBNull(i);
/// <summary>
/// Gets the number of columns in the current row.
/// </summary>
/// <returns>
/// When not positioned in a valid recordset, 0; otherwise, the number of columns in the current record. The default is -1.
/// </returns>
/// <filterpriority>2</filterpriority>
public int FieldCount
get { return _originalReader.FieldCount; }
/// <summary>
/// Gets the column located at the specified index.
/// </summary>
/// <returns>
/// The column located at the specified index as an <see cref="T:System.Object"/>.
/// </returns>
/// <param name="i">The zero-based index of the column to get.
/// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
/// </exception><filterpriority>2</filterpriority>
object IDataRecord.this[int i]
get { return _originalReader[i]; }
/// <summary>
/// Gets the column with the specified name.
/// </summary>
/// <returns>
/// The column with the specified name as an <see cref="T:System.Object"/>.
/// </returns>
/// <param name="name">The name of the column to find.
/// </param><exception cref="T:System.IndexOutOfRangeException">No column with the specified name was found.
/// </exception><filterpriority>2</filterpriority>
object IDataRecord.this[string name]
get { return _originalReader[name]; }
#endregion
#region Implementation of IDataReader
/// <summary>
/// Closes the <see cref="T:System.Data.IDataReader"/> Object.
/// </summary>
/// <filterpriority>2</filterpriority>
public void Close()
_originalReader.Close();
/// <summary>
/// Returns a <see cref="T:System.Data.DataTable"/> that describes the column metadata of the <see cref="T:System.Data.IDataReader"/>.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.DataTable"/> that describes the column metadata.
/// </returns>
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Data.IDataReader"/> is closed.
/// </exception><filterpriority>2</filterpriority>
public DataTable GetSchemaTable()
return _originalReader.GetSchemaTable();
/// <summary>
/// Gets a value indicating the depth of nesting for the current row.
/// </summary>
/// <returns>
/// The level of nesting.
/// </returns>
/// <filterpriority>2</filterpriority>
public int Depth
get { return _originalReader.Depth; }
/// <summary>
/// Gets a value indicating whether the data reader is closed.
/// </summary>
/// <returns>
/// true if the data reader is closed; otherwise, false.
/// </returns>
/// <filterpriority>2</filterpriority>
public bool IsClosed
get { return _originalReader.IsClosed; }
#endregion
/// <summary>
/// Advances the data reader to the next result, when reading the results of batch SQL statements.
/// </summary>
/// <returns>
/// true if there are more rows; otherwise, false.
/// </returns>
/// <filterpriority>2</filterpriority>
public bool NextResult()
throw new NotImplementedException();
/// <summary>
/// Advances the <see cref="T:System.Data.IDataReader"/> to the next record.
/// </summary>
/// <returns>
/// true if there are more rows; otherwise, false.
/// </returns>
/// <filterpriority>2</filterpriority>
public virtual bool Read()
if (_batchSize == (_currentSessionRows))
return false;
if(_originalReader.Read())
_currentSessionRows++;
_rowCount++;
return true;
return false;
/// <summary>
/// Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.
/// </summary>
/// <returns>
/// The number of rows changed, inserted, or deleted; 0 if no rows were affected or the statement failed; and -1 for SELECT statements.
/// </returns>
/// <filterpriority>2</filterpriority>
public int RecordsAffected
get { throw new NotImplementedException(); }
public virtual bool ResetState()
bool result = _currentSessionRows != 0;
if (result && RowsCopied != null)
RowsCopied(this, _rowCount);
_currentSessionRows = 0;
return result;
public class VirtualSourceReader:SourceDataReaderWrap
private readonly int _totalRecordCount;
public VirtualSourceReader(IDataReader reader, int batchSize, int totalRecordCount)
:base(reader, batchSize)
_totalRecordCount = totalRecordCount;
public override bool Read()
if (_rowCount >= totalRecordCount || totalRecordCount <= 0)
return false;
if (_rowCount == 0)
return base.Read();
if (_batchSize == _currentSessionRows)
return false;
_currentSessionRows++;
_rowCount++;
return true;
*****************File::tmp.data**********

You have problem because the batch size property has value *10000* and amount of records(*50000*) bigger than this value.
You can retrieve workaround from my post (OracleBulkCopy have memory leak  if BatchSize is less than record's count.

Similar Messages

  • OracleBulkCopy have memory leak

    I have a simple code that caus a memroy leak only when it used OracleBulkCopy:
    static void DoAll(bool withoutBulkCopy)
    using (OracleConnection oracleConnection =
    new OracleConnection("User Id=apolyakov;Password=oracle;Data Source=OPE"))
    oracleConnection.Open();
    using (OracleCommand command = oracleConnection.CreateCommand())
    command.CommandText = "truncate table test_a";
    command.ExecuteNonQuery();
    using (DataTable dataTable = new DataTable("test_a"))
    using (OracleDataAdapter adapter = new OracleDataAdapter("select * from test_a", oracleConnection))
    adapter.Fill(dataTable);
    Console.WriteLine("Begin generating of data (total memory used: {0})", GC.GetTotalMemory(false));
    Random random = new Random();
    for (int i = 0; i < 50000; ++i)
    byte[] bytes = new byte[1024];
    random.NextBytes(bytes);
    dataTable.Rows.Add(random.Next(), random.Next(), Convert.ToBase64String(bytes));
    Console.WriteLine("Generation of DataTable is {0}", GC.GetGeneration(dataTable));
    Console.WriteLine("End generating (total memory used: {0})", GC.GetTotalMemory(false));
    if (!withoutBulkCopy)
    Console.WriteLine(string.Format("Begin writing"));
    using (OracleBulkCopy bulkCopy = new OracleBulkCopy(oracleConnection))
    bulkCopy.BatchSize = 10000;
    bulkCopy.NotifyAfter = 10000;
    bulkCopy.BulkCopyTimeout = 100;
    bulkCopy.OracleRowsCopied += new OracleRowsCopiedEventHandler(bulkCopy_OracleRowsCopied);
    bulkCopy.DestinationTableName = "test_a";
    bulkCopy.WriteToServer(dataTable);
    Console.WriteLine(string.Format("End writing (total memory used: {0})", GC.GetTotalMemory(false)));
    static void bulkCopy_OracleRowsCopied(object sender,OracleRowsCopiedEventArgs eventArgs)
    Console.WriteLine("Wrote {0} rows.", eventArgs.RowsCopied);
    [STAThreadAttribute]
    static void Main(string[] args)
    try
    Console.WriteLine("Managed memory usage: {0}, unmanaged: {1}", GC.GetTotalMemory(false), Process.GetCurrentProcess().WorkingSet64);
    DoAll(false);
    Console.WriteLine("Managed memory usage: {0}, unmanaged: {1}", GC.GetTotalMemory(false), Process.GetCurrentProcess().WorkingSet64);
    Console.WriteLine("Run collect, press enter to continue");
    Console.ReadLine();
    GC.Collect();
    GC.GetTotalMemory(true);
    Console.WriteLine("Managed memory usage: {0}, unmanaged: {1}", GC.GetTotalMemory(true), Process.GetCurrentProcess().WorkingSet64);
    Console.WriteLine("End of collecting");
    Console.ReadLine();
    catch (Exception ex)
    Console.WriteLine(ex.Message);
    Console.ReadLine();
    DML for table test_a: "create table test_a (a number, b number, c nvarchar2(2000));"
    When I run method 'DoAll(false)' it takes a ~147MB managed memory and ~307MB total physical memory. After memory collecting it takes a 0.1MB managed and 161MB physical memory. When I set flag 'withoutBulkCopy' to 'true' and ran application again it took same size of managed memory, but 190MB physical memory and after collecting it took 51MB physical.
    If I use System.Data.SqlClient instead of Oracle.DataAccess.Client in this application it takes normal memory size, and after collecting it return to OS almost all memory (19MB physical memory usage).
    System: ODAC 11.1 (1110621), .NET Framework 2.0, WinXP SP3, Oracle Database 10g2
    This is a very important problem, because in real case we have a 137 column datasource with 500k rows. And we lost 500-700MB memory =((
    Please, answer to me how I can avoid this memory leak.
    Thanks.
    Edited by: Cloun on Feb 9, 2009 6:10 PM

    You have problem because the batch size property has value *10000* and amount of records(*50000*) bigger than this value.
    You can retrieve workaround from my post (OracleBulkCopy have memory leak  if BatchSize is less than record's count.

  • Since the itunes 10.4.1 update  I have memory leaks problems.

    Since the itunes 10.4.1 update  I have memory leaks problems, Itunes used memory start at about 100 megs as usual but when it play the ram usage climb about 4 kb per second ( one time I had itunes using 690 megs !). I had to periodically close and restart Itunes to clear the memory.
    Someone has suggestion to resolve this problem?

    Same issue, Running Windows 7 x64 with 6 Gigs of RAM and have iTunes 10.4.1 32bit version.
    I wanted to break in some headphones over the weekend, so left it playing a loop of songs. Came back on Monday to see my machine using a huge amount of RAM and iTunes just froze.
    Here is a shot of my Task Manager showing iTunes was using 1.5gigs of Memory.

  • I have a iMAC(got it in less than 2 months ago), can I change the memory(upgrade it from 4 GB to 8GB) myself? I mean I need to open the screws and exchange the memory chips. Does it cancel the guarantee?

    I have a iMAC(got it in less than 2 months ago), can I change the memory(upgrade it from 4 GB to 8GB) myself? I mean I need to open the screws and exchange the memory chips. Does it cancel the guarantee?

    No, unless you break something or install the wrong RAM, new RAM is not covered by warranty/AppleCare of course.
    https://support.apple.com/kb/HT3011
    https://discussions.apple.com/docs/DOC-4291

  • Question why has my balance on my itune account have totally disappeared when I have only been using it for less than a year? had still fair bit of money in it too. around $60

    Question why has my balance on my itune account have totally disappeared when I have only been using it for less than a year? had still fair bit of money in it too. around $60

    First, make sure you're logged into the iTunes Store using the account ID and password you set up, or used, when you redeemed your card/gift.  If you are, try signing out of the account and back in.
    If you're sure you are using the correct account and that you're signing in to the iTunes Store, and signing out and back in doesn't help, go to the Purchase History and review your purchases to make sure that you should indeed have a balance left. iTunes doesn't always refresh the balance it shows, so it's possible you spent the money and it just wasn't being reflected in the display. This display error can usually be corrected by logging out of the iTunes Store and then back in.
    If you confirm that you should have balance left but the iTunes Store isn't showing it correctly, send a message to the iTunes Store customer service department through the contact form you'll find by selecting the most applicable section of their Support page (select the Contact Support link and follow the instructions) and explain the problem to them.
    Good luck.

  • I have had my iphone 4 for less than 3 months and i always have it in a protective case, recently my bluetooth that i use daily will not stay connected, my alarm clock will not ring, any suggestions on whats going on??

    i have had my iphone 4s for less than 3 months and i always have it in a protective case, recently my bluetooth that i use daily will not stay connected, my alarm clock will not ring, any suggestions on whats going on??

    Basic troubleshooting from the User's Guide is reset, restart, restore (first from backup then as new).  Try each of these in order until the issue is resolved.

  • Airport Extreme appears to have memory leak; sluggish after long uptime

    For a long time now, I have been frustrated by what appears to be a memory leak in the Airport Extreme firmware. After the unit has been running for a few weeks (and this varies from one week to one month approximately), the WLAN to LAN routing performance will drop drastically. It will go from ping times (from a WLAN host to a LAN host) of 1 mS or less to ping times in excess of one second.
    In this broken state, all traffic through the unit is dog slow. Doesn't matter what the traffic is-- if it's to and from the wireless LAN, it's going to take forever.
    If I power cycle the Airport Extreme, the problem will go away for another few weeks. I have dealt with this issue for several years with the hope that eventually a firmware upgrade would come that fixed it. So far, no such fix.
    Is anyone else experiencing this sort of behavior? When it isn't sluggish, the unit works wonderfully with Mac, Windows and Linux wireless clients so I have no reason to blame anything but the Extreme... particularly since the bandaid is a power cycle of it.
    All of my clients are 802.11b/g, no 'n' in service here.

    Boot into safe mode (restart holding down SHIFT key). If no KP, then uninstall and reinstall those 3rd-party items that Roger pointed out, one at a time, and restart. Continue until you determine which ones are causing the problem. If KP while in safe mode, then most likely hardware related. Run the Apple Hardware Test suite, extended tests at least twice, followed by Rember.  See
    OS X About kernel panics,
    Technical Note TN2063: Understanding and Debugging Kernel Panics,
    Mac OS X Kernel Panic FAQ,
    Resolving Kernel Panics,
    How to troubleshoot a kernel panic, and
    Tutorial: Avoiding and eliminating Kernel panics for more details.

  • Applescript Image Events appears to have memory leak (or I don't know what I am doing)

    Using Image Events to create images and thumbnails for a website. The following code results in very large memory leaks in Image Event process. I have documented results of test runs in the comments.
    The leak (or poor coding on my part) results in a total system halt if I attempt to process more than about 400 images at a time. Basically, I run out ot physical memory. I am running a new model 13" MBP with 8GM RAM.  I have to manually stop Image Events to reclaim the memory (or reboot of course).
    Any help/suggestions would be appreciated.
    (* test memory leak in Image Events *)
              tests with 58 photos selected in iPhoto
              5.7 MB left in Image Events after run with only open and close
              22.0 MB left in Image Events after run with open, save and close
              45.9 MB left in Image Events after run with open, scale, save and close
              A run with 382 photos selected used OVER 3.8 GB (gigabytes) and the
              mac ran out of physical memory so I had to stop the test.
    tell application "Finder"
              set imageFolder to folder "test" of home as alias
    end tell
    tell application "iPhoto"
              set currPhotoList to the selection
              repeat with currPhoto in currPhotoList
                        log name of currPhoto as string
                        set theImagePath to image path of currPhoto
                        tell application "Image Events"
      launch
                                  set theImage to open theImagePath
      scale theImage to size 128
      save theImage in imageFolder as JPEG with icon
      close theImage
                        end tell
              end repeat
    end tell
    --- end of code example

    Does the following code do any difference? Most likely no I guess… but better try than nothing.
    tell application "Finder"
        set imageFolder to folder "test" of home as text -- instead of “as alias” (see theTargetPath below)
    end tell
    set theImagePaths to {}
    set theImagePathsRef to a reference to theImagePaths -- faster with big lists
    tell application "iPhoto"
        set currPhotoList to the selection
        repeat with currPhoto in currPhotoList
            log name of currPhoto as string
            get POSIX file (image path of currPhoto) as alias -- faster ?
            copy result to the end of theImagePathsRef
        end repeat
    end tell
    tell application "Image Events"
        launch
        repeat with theImagePath in theImagePaths
            set theImage to open theImagePath
            scale theImage to size 128
            set theTargetPath to (imageFolder & name of theImagePath)
            save theImage in theTargetPath as JPEG with icon
            close theImage
        end repeat
    end tell

  • Does Bridge have memory leaks?

    I've been using Bridge as a browser for a year now and I find that the longer it runs the more cumbersome it becomes - it's slow and memory intensive to begin with, but if I leave it running for a few hours it eventually becomes ungainly and it slowes down my other apps considerably - the only thing I can do is to periodicaly quit Bridge and re-start it, then everything is fine again (for a while) - What's this all about? Does Bridge have major memory problems or leaks? Why is it so cumbersome? Anyone else experiencing this?
    DF

    No known ones in Bridge 1.0.4.
    There were some in Bridge 1.0, but those were fixed in subsequent releases.

  • HT2978 my earphones just broke, will apple store replace them for free if i have apple car and has been less than a year since i bought the phone ?

    please help

    There's only one way to find out what Apple might do in your case. Make an appointment at an Apple Store to have your device examined by a technician. Or contact Apple Support.
    I will say though that I've had two iPads and an iPhone and my wife also has an iPhone. Total use time is 6-7 years and we've never had a cable tear or fail.

  • I have had my Iphone 4 for less than a week and daily it freezes and makes me restore

    any one know why my iphone 4 constantly freezes. it wont let me go on certain aps or text then gets stuck with apple logo
    restore works but then it happens again every day

    Sounds like you have a corrupt app or software.  Restore AS NEW.  Then try without any 3rd party apps.  If the phone works, begin adding your apps back one by one and trying your phone between each new app to see which might be at fault.

  • CS3 - Create24bitRGBPreview: Memory leak?

    Hi
    I use Create24bitRGBPreview to create a preview in my plugin (SDK sample PnlTrvCustomView). When I do this, I have memory leaks after finishing Indesign. I delete my allocated buffer, but there is always a leak. I don't find another possibility for the leaks. When I don't show the preview, it is OK.
    Any ideas?
    What could be wrong?
    I have the same effect in the SDK sample! Any workarounds?
    Thanks
    Hans

    Have you tried setting the memory allocated to Photoshop to 55% or less? You are probably starving other processes running outside Photoshop.
    Reduce the memory states to no more than 20.
    Is your scratch disk a fast internal one? Most external drives are too slow. You keep saying "plenty of space" but bear in mind that the scratch files will need about 10x the original file size and this soon mounts up to a lot of gigs.
    With that computer you are hitting the limits for working with files of that size.

  • JBoss EAP 6 On JRockit - Memory Leak

    hello team.
    I have memory leak problem on jboss and jrockit.
    My Environment :
    1. OS :          
    CentOS release 6.4 (Final)
    2. JRockit :     
    java version "1.6.0_45"
         Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
         Oracle JRockit(R) (build R28.2.7-7-155314-1.6.0_45-20130329-0641-linux-x86_64, compiled mode)
    3. Application Server:
    JBoss EAP 6.2.0.GA
    4. Application
    Large EJB Application (100 and more EJB Beans (Stateless, Stateful,  MDB, Timers and so on)
    Everything works fine on older application server versions (4.3 , 4.2)
    But now I have Problem
    Of course I know that problem is new version - and i have discussion on JBoss forums.
    but guys I have question about jrockit with you:
    What is the option "Other" in memory ??
    [jboss@jboss-new bin]$ jrcmd 17114  print_memusage
    17114:
    Total mapped                       8457864KB           (reserved=2983100KB)
    -              Java heap              3145728KB           (reserved=0KB)
    -              GC tables            105232KB         
    -          Thread stacks       46412KB           (#threads=138)
    -          Compiled code       1048576KB           (used=12257KB)
    -               Internal                   1480KB         
    -                     OS       170324KB         
    -                  Other       3639056KB         
    -            Classblocks         10496KB           (malloced=9631KB #28393)
    -        Java class data       289536KB           (malloced=192391KB #133697 in 28393 classes)
    - Native memory tracking     1024KB           (malloced=294KB #10)
    [jboss@jboss-new bin]$
    This size increases every time - and took entire amount of RAM.
    Thank in Advance.
    Regards,
    Paata Lominadze

    Not sure what the 'other' is, but it is probably best shown by using an example. By using displayMap we can display a memory map of various JVM subsystems and libraries that are loaded, including third-party libraries.
    ./jrcmd 4523 print_memusage displayMap
    Total mapped                  3984796KB           (reserved=2978740KB)
    -              Java heap       524288KB           (reserved=0KB)
    -              GC tables        17548KB         
    -          Thread stacks        20276KB           (#threads=39)
    -          Compiled code      1048576KB           (used=14224KB)
    -               Internal         1672KB         
    -                     OS       146924KB         
    -                  Other      2092648KB         
    -            Classblocks         7424KB           (malloced=7381KB #20064)
    -        Java class data       124416KB           (malloced=124411KB #91048 in 20064 classes)
    - Native memory tracking         1024KB           (malloced=118KB #10)
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        OS                          *java    r x 0x0000000000400000.(     76KB)
        OS                          *java    rw  0x0000000000612000.(      4KB)
        OS                        *[heap]    rw  0x00000000007c1000.(    132KB)
       INT                           Poll    r   0x000000007fffe000 (      4KB)
       INT                         Membar    rw  0x000000007ffff000.(      4KB)
       MSP              Classblocks (1/2)    rw  0x00000000df8c0000 (   6912KB)
       MSP              Classblocks (2/2)    rw  0x00000000dff80000 (    512KB)
      HEAP                      Java heap    rw  0x00000000e0000000.( 524288KB)
        OS                    *ld-2.12.so    r x 0x0000003664400000.(    128KB)
        OS                    *ld-2.12.so    r   0x000000366461f000 (      4KB)
        OS                    *ld-2.12.so    rw  0x0000003664620000 (      4KB)
        OS                   **ld-2.12.so    rw  0x0000003664621000.(      4KB)
       OS           *gconv-modules.cache    r   0x00007f8f2e4a0000 (     28KB)
    THREAD                     Stack 4630    rwx 0x00007f8f2e4a7000 (      8KB)
    THREAD                     Stack 4630        0x00007f8f2e4a9000 (     12KB)
    THREAD                     Stack 4630    rwx 0x00007f8f2e4ac000 (    244KB)
       MSP         Java class data (5/37)    rw  0x00007f8f2e4e9000 (  14336KB)
       MSP         Java class data (9/37)    rw  0x00007f8f2fa40000 (   5888KB)
                                             rw  0x00007f8f30000000 (    188KB)
                                                 0x00007f8f3002f000 (  65348KB)
                                             rw  0x00007f8f34000000 (    132KB)
                                                 0x00007f8f34021000 (  65404KB)
                                             rw  0x00007f8f38000000 (    412KB)
                                                 0x00007f8f38067000.(  65124KB)
       MSP        Java class data (10/37)    rw  0x00007f8f3c034000 (  34048KB)
                                             rw  0x00007f8f3e174000 (   8200KB)
       MSP        Java class data (11/37)    rw  0x00007f8f3e976000 (    256KB)
        OS                     *libhpi.so    rw  0x00007f8fb37fc000 (      8KB)
        OS                    **libhpi.so    rw  0x00007f8fb37fe000 (      4KB)
      CODE                  Compiled code    rwx 0x00007f8fb37ff000 (     64KB)
      CODE                  Compiled code    rwx 0x00007f8fb380f000 (    128KB)
      CODE                  Compiled code    rwx 0x00007f8fb382f000 (     64KB)
      MSP        Java class data (37/37)    rw  0x00007f8ff83a1000 (    512KB)
        GC Modified Union Set (committed)    rw  0x00007f8ff8421000 (    132KB)
        GC                     Card table    rw  0x00007f8ff8442000 (   1024KB)
        GC        Object bits (committed)    rw  0x00007f8ff8542000 (   8196KB)
    Here
    - thread is thread related (such as thread stacks)
    - int, internal use (such as pointer pages)
    - heap, chunk used by JRockit for the Java heap
    - os, mapped directly from the operating system, such as third party DLLs or shared objects
    - msp, memory space. a memory space is a native heap with a specific purpose, for example native memory allocation inside the JVM
    - gc, garbage collection related, for example live bits
    - code, compiled code
    The 'other' memory space looks to me (from the blank entries in the above print-out) like they are a memory pages to are still not used. When the JVM starts it mappes an amount of memory. To my knowledge JRockit uses mmap (mmap(2) - Linux manual page), which creates a new mapping in the virtual address space. JRockit reserves an amount of memory (Java Heap (heap where your object instances go) + its own runtime (all the others)).
    To see where the growth is in the various memory spaces, you can use 'print_memusage baseline', after which you can execute print_memusage again, for example,
    ./jrcmd 4523 print_memusage scale=M
    4523:
    Total mapped                     3896MB      +4MB (reserved=2905MB -3MB)
    -              Java heap          512MB           (reserved=0MB)
    -              GC tables           17MB         
    -          Thread stacks           19MB           (#threads=39)
    -          Compiled code         1024MB           (used=14MB +1MB)
    -               Internal            1MB         
    -                     OS          143MB         
    -                  Other         2043MB         
    -            Classblocks            7MB           (malloced=7MB #20596 +532)
    -        Java class data          126MB      +4MB (malloced=125MB +4MB #93640 +2592 in 20596 classes)
    - Native memory tracking            1MB           (malloced=0MB #20 +10)
    Note the additional column that prints out the difference in memory usage in relation to the baseline. You can also monitor native allocations by using trace_alloc_sites, memory allocations can then be displayed with different levels of detail using the level argument.
    ./jrcmd 4523 print_memusage trace_alloc_sites=true
    4523:
    Total mapped                  3989660KB   +4864KB (reserved=2974732KB -4008KB)
    -              Java heap       524288KB           (reserved=0KB)
    -              GC tables        17548KB         
    -          Thread stacks        20276KB           (#threads=39)
    -          Compiled code      1048576KB           (used=15265KB +1040KB)
    -               Internal         1672KB         
    -                     OS       146924KB         
    -                  Other      2092648KB         
    -            Classblocks         7680KB    +256KB (malloced=7669KB +287KB #20596 +532)
    -        Java class data       129024KB   +4608KB (malloced=128967KB +4555KB #93640 +2592 in 20596 classes)
    - Native memory tracking         1024KB           (malloced=236KB +118KB #20 +10)
    ./jrcmd 4523 print_memusage level=3
    4523:
    Total mapped                  3989660KB   +4864KB (reserved=2974732KB -4008KB)
    -              Java heap       524288KB           (reserved=0KB)
    -              GC tables        17548KB         
    -          Thread stacks        20276KB           (#threads=39)
    -          Compiled code      1048576KB           (used=15265KB +1040KB)
    -               Internal         1672KB         
    -                     OS       146924KB         
    -                  Other      2092648KB         
    -            Classblocks         7680KB    +256KB (malloced=2KB -7379KB #4 -20060) Not fully traced
    -        Java class data       129024KB   +4608KB (malloced=26KB -124385KB #16 -91032 in 20596 classes) Not fully traced.
    - Native memory tracking         1024KB           (malloced=118KB #10) Not fully traced.
         gather_memorymap_database                     memtrace.c: 206         91KB     +91KB (#1 +1)
               gather_memory_usage                  osal_mspace.c:5142          7KB      +7KB (#4 +4)
      msGatherMSpacesUsageDatabase                  osal_mspace.c:6128          2KB      +2KB (#1 +1)
      msGatherMSpacesUsageDatabase                  osal_mspace.c:6134         16KB     +16KB (#1 +1)
    Note this is more on the JVM level, in your case in might be beneficial to investigate what is happening on the java heap. By using print_object_summary you can get insight how memory on the heap is used on a per-class basis. To get to the bottom of where the memory leak is you can use the memory-leak-detector (an example of its use can be found here Middleware Snippets: Fast, Faster, JRockit). You can also obtain a heapdump that can be analyzed by using for example MAT (see for an example here Middleware Snippets: Visualizing Class Loading). To obtain a heapdump you can run the command, for example,
    [weblogic@machine1 bin]$ ./jrcmd 4523 runsystemgc full=true fullcompact=true
    4523:
    [weblogic@machine1 bin]$ ./jrcmd 4523 hprofdump filename=/home/weblogic/dump.hprof
    4523:
    Wrote dump to /home/weblogic/dump.hprof
    Note that this first issues a full GC by using the runsystemgc command.

  • Memory leak with variant/OCX

    I'm trying to get images from an IP webcam thanks to an ActiveX and process them with IMAQ.
    This ActiveX needs a variant to put chars from the image. It seems to work fine, (nearly 'in real-time') when I convert a string into a variant. Nevertheless, I have memory leak, if I put this sub-VI into a while loop.
    So, rather than using a string conversion, I've tried to use a Uchar array conversion. It also seems to work but it is really slow and in this case I don't have any leak of memory !
    I'm likely misunderstand the memory managment of Labview.
    Thank you very much for your help.

    Sorry for the VIs I've sent.
    Here are simplified VIs, with comments that illustrate the problem.
    I hope this will bring you clearer informations.
    Olivier M.
    Attachments:
    test_snap.vi ‏57 KB
    InitAxis.vi ‏36 KB
    SnapAxis.vi ‏38 KB

  • SQL toolkit 2.2 Stored Procedure Memory Leaks

    Hi
    we are using CVI 2012 and SQL Toolkit 2.2. My db is "MySql 5.5.28" and I use "MySQL Connector/ODBC 5.2(w)"
    I use only stored procedure (with and without the output parameters).  If I call continuously a stored procedure,
    with Sql toolkit code, I have memory leaks!! 
    My code (without error handler) is:
    // iDbConnId is the handle of DBConnect() called when program starts
    iStmt = DBPrepareSQL(iDbConnId, "spGetPrData");
    DBSetStatementAttribute(iStmt, ATTR_DB_STMT_COMMAND_TYPE, DB_COMMAND_STORED_PROC);
    DBExecutePreparedSQL(iStmt);
    DBBindColLongLong(iStmt, 1, &llPrId, &lStatus1);
    DBBindColInt(iStmt, 2, &iIpPort, &lStatus2);
    while(DBFetchNext(iStmt) != DB_EOF)
        //get data
    DBClosePreparedSQL(iStmt);
    DBDiscardSQLStatement(iStmt);
    If I call the same stored procedure by sql code ("CALL spProcedure()")
    I don't have memory leaks!!
    The code is (without error handler):
    // iDbConnId is the handle of DBConnect() called when program starts
    iStmt = DBActivateSQL(iDbConnId, "CALL spGetPrData();");
    DBBindColLongLong(iStmt, 1, &llPrId, &lStatus1);
    DBBindColInt(iStmt, 2, &iIpPort, &lStatus2);
    while(DBFetchNext(iStmt) != DB_EOF)
        //get data
    DBDeactivateSQL (iStmt)
    It seems to me that the DBDeactivateSQL function free the memory correctly,
    while the functions DBClosePreparedSQL and DBDiscardSQLStatement do not release properly the memory,
    (or I use improperly the library functions!!!)
    I also have a question to ask:
    Can I open and close the connection every time I connect to the database or is it mandatory to open and close it just one time?
    How can I check the status of the database connection, if is mandatory to open and close the db connection just one time?
    Thanks for your help.
    Best Regards
    Patrizio

    Hi,
    one of the functions "DBClosePreparedSQL and DBDiscardSQLStatement" is a known problem. In fact, there is a CAR (Corrective Action Request 91490) reporting the problem. What version of the toolkit are you using?
    About this function you refer to the manual:
    http://digital.ni.com/manuals.nsf/websearch/D3DF4019471D3A9386256B3C006CDC78
    Where functions are described. To avoid memory leaks DBDeactivateSQL must be used. DBDeactivateSQL is equivalent to calling DBCloseSQLStatement, then DBDiscardSQLStatement. DBDeativateSQL will work at all for parameterized SQL, as well.
    Regarding the connection mode advice to you is to open the connection once and close it at the end of your operations. What do you mean with "state of the database connection"? Remember that if you have connection problems or something goes wrong, the errors appears in any point in your code where you query the database. Bye
    Mario

Maybe you are looking for

  • Infamous WHINE & lack of Processor Performance settings?

    I have owned all of the Al books from the 1ghz 17" to the 1.67 17". I noticed the whine first on the 15" 1.25 AlBook 2 yrs ago. During that time we were able to throttle the Processor settings ourselves via the Energy Saver setting in System Preferen

  • How do I update a pending book project on iTunes Connect?

    I successfully uploaded my book and all assets to iTunes Producer. I received a ticket about my use of the term iBook (not allowed) and corrected the book file. I am having trouble updating the files. When I tried to update the files I received an er

  • How do I create "metallic" text in Keynote 4?

    Hello everyone! I'm in need of some advice. I have been searching across the internet for a way to create metallic text in Keynote 4, similar to the black metallic text that Steve Jobs uses in his keynotes. Is this possible with Keynote 4, or do I ne

  • Running Snow Leopard but need Tiger for ONE application... Possible?

    Hello all... I currently have an intel Macbook Pro which is about 3.5 yrs old. My OS is Snow Leopard 10.6.4 and I love it.. however, I also need to use an old version of Avid Xpress Pro which recommends running 10.4.6-10.4.8 (Tiger). This is the only

  • Please help with icloud

    Can you lease help I have tried to purchase storage from I cloud but it hasn't given me any but taken my money from my bank account? Thankyou