Does python sqlite3 deallocate a memory only database in interactive mode? -


i looking @ python unit tests sqlite3 today , noticed awesome

sqlite.connect(":memory:")

this cool idea makes unit tests easier write. started wondering, sqlite3 dealloacte memory used? sqlite3 smart enough deallocate in interactive mode?

yes.

before:

user       pid %cpu %mem    vsz   rss tty      stat start   time command ryan     27162  0.4  0.2  29492  5348 pts/7    s+   15:17   0:00 python 

after inserting 500000 rows:

ryan     27162 14.3  0.7  45436 15064 pts/7    s+   15:17   0:13 python 

after db.close()

ryan     27162 11.9  0.4  38620  8368 pts/7    s+   15:17   0:13 python 

however, after inserting 500000 rows , doing db.execute("drop table test"), memory usage not freed again. creating new test db , inserting rows again did not cause additional memory allocations, looks memory wasn't returned os.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -