System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: dbef3dacfbf47af5bd9affebc56994ebcbf4e1e5
Title: System.OutOfMemoryException
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: LINQ Resolution: Need_More_Info
Last Modified: 2018-03-01 18:12:56
Version Found In: 1.0.103
User Comments:
anonymous added on 2018-02-09 09:02:20:
Hallo All,
We experience System.OutOfMemoryException while adding ONE record into the SQLite database.
we are using the SQLite database with in Windows 32 Bit system, VisualStudio 2015, c# CodeFirst (System.Data.SQLite.EF6.dll ) and using "Unit of Work" as Design Pattern.
we have 9 Tables in the DB (one file) and the size limit of the table is 100'000 record per table.
after approximately 2 to 3 Months we are arriving to the limit in some of our tables and then we are deleting the oldest record before we insert (by add) the new record.
then we getting System.OutOfMemoryException as well.

code:
public void WriteDataToDb(RunPartInfoEntry data)
		{
			using (var db = HmiDataContext.CreateDbContext())
			{
				var res = db.WriteDataToDb(data);

				if (!res && db.HasErrors)
				{
					Log.Error(db.ErrorMessage);
				}
			}
		}

public bool WriteDataToDb(RunPartInfoEntry data)
		{
			try
			{
				DeleteFromDb(RunPartInfoRecords);
				RunPartInfoRecords.Add(data);
				return SaveChangesInDb();
			}
			catch (Exception exception)
			{
				ErrorMessage = exception;
				return false;
			}
		}		

can you please tell us what is the problem ? 
what are we making wrong?
how can we solve the out of memory problem ?

thank you for your answer
with kind regards 
Jaron

mistachkin added on 2018-02-09 22:56:59:
The code snippet you included seems a bit vague.  It does not reference the
System.Data.SQLite classes at all.

When you say "size limit of the table is 100'000 record per table", what do
you mean by "limit"?  If there is a limit, how is it enforced?

One thing that might be revealing is enabling tracing of all executed SQL
statements when there is an error.  To do this, set the "SQLite_ForceLogPrepare"
environment variable (e.g. to "1") and then capture the TraceListener output to
a file.