View Ticket
Not logged in
Ticket Hash: 768ee11d7dcdc95025fb106972410b7acd14101e
Title: Execution of CREATE INDEX generates System.OutOfMemoryException
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Integration_Via_PInvoke Resolution: Not_A_Bug
Last Modified: 2011-12-12 11:04:04
Version Found In:
When executing the CREATE INDEX NonQuery in a table with almost 60 million records, system increases the memory and after some seconds the next error issues:

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

at System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo method, O bject[] args, SignatureStruct& signature, RuntimeType declaringType)
at System.RuntimeMethodHandle.InvokeConstructor(IRuntimeMethodInfo method, Ob ject[] args, SignatureStruct signature, RuntimeType declaringType)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, B inder binder, Object[] parameters, CultureInfo culture)
at System.SecurityUtils.ConstructorInfoInvoke(ConstructorInfo ctor, Object[] args)
at System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type base Type, String initializeData)
at System.Diagnostics.TypedElement.BaseGetRuntimeObject() at System.Diagnostics.ListenerElement.GetRuntimeObject() at System.Diagnostics.ListenerElementsCollection.GetRuntimeObject() at System.Diagnostics.TraceInternal.get_Listeners() at System.Diagnostics.TraceInternal.WriteLine(String message) at System.Data.SQLite.SQLiteLog.LogEventHandler(Object sender, LogEventArgs e ) at System.Data.SQLite.SQLiteLog.LogCallback(IntPtr pUserData, Int32 errorCode , IntPtr pMessage) at System.Data.SQLite.UnsafeNativeMethods.sqlite3_step(IntPtr stmt) at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) at System.Data.SQLite.SQLiteDataReader.NextResult() at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavi or behave) at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() at Facilities.DB.LibSQLite.ExecNonQuery(String qry, Object[] args) at ttbsap.CmpExistenc.SetIndexesTTB()

The code is:

using (LibSQLite db = new LibSQLite(@"Data Source=inv.db3;"))


using (SQLiteTransaction transac = db.BeginTransaction())
res = db.ExecNonQuery("CREATE INDEX ttb_1 on ttb(sts);");
catch (Exception ex)


mistachkin added on 2011-12-12 03:01:01 UTC:
Is this issue new to version 1.0.77 or can it be reproduced with earlier versions? Is the process actually running out of memory (or address space if it is a 32-bit process) at the point where the exception is thrown?

anonymous added on 2011-12-12 06:25:47 UTC:
Mistachkin, I am not sure if the problem is new in previous versions. However, I believe I found a possible cause, but I do not know why. Before reporting the problem, I uncompressed the file in a windows 7-64 bit and I explicitly compiled with processor "X86". The execution generated the error that I reported. The reason I generated in X86 is that I perceived it is a bit faster than X64 when loading data into the Sqlite database.

Some minutes ago, I replaced it by sqlite-netFx40-binary-X64-2010- and I compiled with processor "Any CPU". I executed the program and this time, no error was issued.

DO you have any explanation about this, before considering the ticked as fixed? My best regards.


mistachkin added on 2011-12-12 07:52:05 UTC:
It's possible that the SQLite query you are attempting to execute is trying to allocate more than 2GB of memory. This would exceed the amount of address space for a user-mode 32-bit process on Windows, causing an "out of memory" exception even when there is plenty of physical RAM available.

anonymous added on 2011-12-12 11:04:04 UTC:
Many, many thanks for your attention and help.