macOS 10.14.6, Xojo 2019R3 or Xojo 2019R2.1
Hello,
I load data into an in-memory SQLite database. When updating the code to API 2.0 the memory consumption of the app gets huge (the app even crashes in 32 bit mode).
Comparing the memory consumptiom I get:
API_1 memory usage: 289.3 MB
API_2 memory usage: 8.34 GB (the app crashes in 32-bit mode)
I am doing something wrong or is this a memory leak?
Here is a simplified example of the API 1.0 code:
[code]dim SQLiteDB as new SQLiteDatabase
dim s as String
dim r, c as Integer
const NrOfRows = 1000000
const NrOfColumns = 20
dim DBRow as DatabaseRecord
if SQLiteDB.Connect = FALSE then
MsgBox(“SQLiteDB.Connect = FALSE”)
Return
end if
s = “CREATE TABLE Data (Row INTEGER)”
SQLiteDB.SQLExecute(s)
for c = 1 to (NrOfColumns)
s = “ALTER TABLE Data ADD COLUMN col_” + Str© + " TEXT"
SQLiteDB.SQLExecute(s)
next
for r = 1 to NrOfRows
DBRow = new DatabaseRecord
DBRow.IntegerColumn(“Row”) = r
for c = 1 to NrOfColumns
DBRow.Column(“col_” + Str©) = Str® + " / " + Str©
next
SQLiteDB.InsertRecord(“Data”, DBRow)
next[/code]
Here is a simplified example of the API 2.0 code:
[code]var SQLiteDB as new SQLiteDatabase
var s as String
var r, c as Integer
const NrOfRows = 1000000
const NrOfColumns = 20
var DBRow as DatabaseRow
if SQLiteDB.Connect = FALSE then
MsgBox(“SQLiteDB.Connect = FALSE”)
Return
end if
s = “CREATE TABLE Data (Row INTEGER)”
SQLiteDB.ExecuteSQL(s)
for c = 1 to (NrOfColumns)
s = “ALTER TABLE Data ADD COLUMN col_” + Str© + " TEXT"
SQLiteDB.ExecuteSQL(s)
next
for r = 1 to NrOfRows
DBRow = new DatabaseRow
DBRow.Column(“Row”).IntegerValue = r
for c = 1 to NrOfColumns
DBRow.Column(“col_” + Str©).StringValue = Str® + " / " + Str©
next
SQLiteDB.AddRow(“Data”, DBRow)
next[/code]