antonpuz
antonpuz

Reputation: 3316

docker shows no memory release of SQLite database

I am checking the amount of memory that SQLite operations consume (mostly insert).

I run my program on docker container, and inspect the memory usage with docker stats <container id>. I observe a weird behavior where the memory usage only grows and doesn't return to normal after the operation has complete.

here is a snippet of the code:

conn =  sqlite3.connect(app.config['DATABASE'])
cur = conn.cursor()
cur.execute('insert into users (uid, full_name, email, username, job_title) values (?,?,?,?,?)', [user_cn, user_full_name, user_email, user_uname, user_jobtitle])
conn.commit()
conn.close()

Its only a snippet (I cutted out most of the code), this procedure takes place thousands of times (commit on every insert, close once at the end).

As I said I observe only an increase in the memory usage on stats, another thing I observed is that top doesn't show any memory activity (stays 0.1%).

On my research I tried running some dummy operation on the linux:

for i in {1..100000}; do echo "aaaaaaaaaaaaaaaaaaa" >> woot.data; done

I observed the same behavior so I guess it's not SQLite's problem but I still include it since its my usecase and maybe its configuration/connection close related stuff.

Any advice on solving this mystery will be highly appreciated!

EDIT: The docker's version is: Docker version 1.5.0, build a8a31ef/1.5.0

Upvotes: 1

Views: 357

Answers (1)

VonC
VonC

Reputation: 1329002

That can depends on your actual host, and docker version.

For instance:

  • With docker 1.11-rc4, memory leaks are reported (issue 21837) and
  • on Mac, docker 1.11.0rc3 contains a bug that doesn't show the memory-limit in stats (issue 21848)

Upvotes: 1

Related Questions