I am having problems with an application of mine leaking memory. The
application reads in some files, parses the data, and does a few
inserts and/or updates depending on the data in the files. My problem
is that the applications memory usage (as reported by top) is growing
by roughly 20-40 bytes every time a file is read and processed.

By writing a couple of test cases, I have identified the problem to
have something to do with the use of transactions. This is illustrated
by a simple test case. If the following insert is put into an infinite
loop the memory usage stays constant (Metadata is a class that
inherits from SQLObject):

while True:
        m = Metadata(
                orderflow = None,
                transaction = None,
                time = DateTime.now(),
                fieldName = "Comment",
                fieldContents = "duh"
                )


However, if the loop is modified to look like this, the memory usage
will keep rising:

while True:
        trans = connection.transaction()
        m = Metadata(
                connection = trans,
                orderflow = None,
                transaction = None,
                time = DateTime.now(),
                fieldName = "Comment",
                fieldContents = "duh"
                )
        trans.commit()

Reusing the same transaction object (with trans.begin()) yields the
same results.
This is using a trunk version of sqlobject (rev. 2171) and psycopg
2.0.5.1 connecting to postgresql 8.1.5. Python is 2.4.3 running on
x86-64.

How do I keep the transactions from leaking memory?

Thanks in advance,
-Toke

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to