While converting our application to use pg.DB().query_formatted() ..

I discovered that pg.DB() leaks, while pg.connect() doesn't.  Here's a minimal
test case.  I'm sorry, but development is not my job and python not my
expertise so I have to leave it here...

Look for "maximum resident set size" in output of:
command time -v python ./pgleak.py
#!/usr/bin/python

import pg
import thread

_db={}
id=thread.get_ident()

def query(text):
	try:
		return _db[id].query(text)
	except KeyError:
		pass
	_db[id]=pg.DB('ts')
	return _db[id].query(text)

def close():
	#print 'l',len(_db)
	_db.pop(id).close()

while 1:
	res = query('SELECT 1 FROM sites').dictresult()
	close()
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to