Re: [pysqlite] unusual memory behavior

"Michael Bayer" <[email protected]> Thu, 28 May 2009 13:01:30 -0400
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
Gerhard H=E4ring wrote:
> Internally, pysqlite has these objects: connections, cursors and
> statements. Connections need to have access to all cursors and
> statements ever created on them. So, the connection object has a *list*
> of weak references for cursors, and a *list* of weak references for
> statements. To keep things simple and efficient, this list is only ever
> appended to. The connection object has also two members
> created_statements and created_cursors that counts the number of
> statement and cursor allocations.
>
> If created_statements or created_cursors reaches 200, the corresponding
> list is scanned for weak references that have unreachable objects (i. e.
> that were del-ed or removed by the gc). The list is then compacted to
> not contain any NULLs. And the counter member is reset to zero.


thats great, since it looked like there was some internal memory
management routine causing this to happen, and I was just curious if it
was known.