memory usage

new BookmarkLockedFalling
meerkat
Senior Member
****

meerkat Avatar

Posts: 250

Post by meerkat on Nov 28, 2008 2:29:22 GMT -5

Not sure this is a bug, but the memory usage of RBP101 continues to rise. Maybe this is normal.
Just looked at the processes using XP and rbp.exe is sitting at 334,780K.
Each time I test my program it gets larger.

I'm using in-memory SQLite talbes. I have a feeling that it does not re-use space created for the in-memory SQLite tables. Each time I test, I think it allocates space for the tables again.

StefanPendl
Global Moderator
*****

StefanPendl Avatar

Run for BASIC ...
Posts: 945

[b]Stefan[/b] - [a href=http://stefanpendl.runbasichosting.com/]Homepage[/a][br][br][b]Please give credit if you use code I post, no need to ask for permission.[/b][br][br]Run BASIC 1.01, Fire-/Waterfox (IE11, Edge), Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
Carl Gundel - admin
Administrator
*****

Carl Gundel - admin Avatar

Posts: 550

meerkat
Senior Member
****

meerkat Avatar

Posts: 250

Post by meerkat on Nov 28, 2008 10:57:37 GMT -5

It will not let you disconnect a in-memory DB.
May be a SQLite thing.

Anyway, since it's in memory, only the session that creates the DB is using it. So they probably assume there is no need to disconnect.

I'll check SQLite for any issues for freeing up memory.
meerkat
Senior Member
****

meerkat Avatar

Posts: 250

Post by meerkat on Nov 30, 2008 11:14:33 GMT -5

I changed my program to use SQLite disk files instead of memory files.

The memory usage still continues to increase.
It hasn't been a problem for me, but I thought I should point it out.

I checked the connect and disconnect and they all match up.
I use two connections to the database.

The program is rather complex and is database I/O intensive.
It does several SQL operations before disconnecting.
It goes through the DB about 50 times using different sorts, and looking for different things.
I wonder if it should be disconnected after each SQL. Seems like a lot of disconnects and connects would be slow...



carlgundel
Administrator
*****
Creator of Run BASIC

carlgundel Avatar

Posts: 975

Post by carlgundel on Nov 30, 2008 12:52:33 GMT -5

meerkat Avatar
I changed my program to use SQLite disk files instead of memory files.

The memory usage still continues to increase.
It hasn't been a problem for me, but I thought I should point it out.

I checked the connect and disconnect and they all match up.
I use two connections to the database.

The program is rather complex and is database I/O intensive.
It does several SQL operations before disconnecting.
It goes through the DB about 50 times using different sorts, and looking for different things.
I wonder if it should be disconnected after each SQL. Seems like a lot of disconnects and connects would be slow...

Connecting and disconnecting is not slow. You should try it to see if it makes any difference.

Is it possible that your code has some sort of memory leak that is unrelated to SQLite?

-Carl
meerkat
Senior Member
****

meerkat Avatar

Posts: 250

Post by meerkat on Nov 30, 2008 13:35:40 GMT -5

Hmmmm!
Was able to isolate it. But don't know why?

The system goes through the database and updates records it finds with another connection.

This increases Memory Usage. And it never gets it back after the disconnect.

sqliteconnect #sql, db$ ' Connect sql
sqliteconnect #sqlA, db$ ' Connect sqlA
#sql execute("SELECT * FROM test")

WHILE #sql finds records it updates them using connection sqlA

#sqlA execute("UPDATE test .....WHERE......")

WEND
#sql disconnect()
#sqlA disconnect()



This does not increase memory

sqliteconnect #sql, db$ ' Connect sql
#sql execute("SELECT * FROM test")

WHILE #sql finds records it updates them using connection sqlA

sqliteconnect #sqlA, db$ ' Connect sqlA
#sqlA execute("UPDATE test ........")
#sqlA disconnect()

WEND
#sql disconnect()


I couldn't find anything on this in the SQLite docs.

Last Edit: Nov 30, 2008 13:44:51 GMT -5 by meerkat