From: Martin d'A. <Mar...@s2...> - 2004-11-30 03:00:29
|
Hi, I think I have found a memory leak. I have a loop that inserts hundreds of thousands of rows in my table, and the memory usage grows eventhough I do not keep a handle to the instances I am creating. For example, the following program will use more memory when you tell it to store more rows in the database: #!/usr/bin/env python import sys from sqlobject import * class Persons(SQLObject): name = StringCol(length=4) def create_table(conn): Persons._cacheValues = False Persons._connection = conn Persons.dropTable(ifExists=True) Persons.createTable() def fill_table(size): for i in xrange(int(size)): p = Persons(name='Joe'+`i`) if __name__ == '__main__': size = sys.argv[1] conn = connectionForURI('mysql://user:passwd@server/test') create_table(conn) fill_table(size) At the prompt, just type "persons.py <number>". The bigger the <number>, the more memory is used. Is there a solution? Martin |