Menu

Memory management

Help
2001-04-23
2012-09-19
  • Christian Stolz

    Christian Stolz - 2001-04-23

    Hi,
    I am using:
    MySQL: 3.23.35
    MySQLdb: 0.3.5
    Python: 2.0 / 2.1

    When I execute a query that returns a really big resultset(About 2MB) then (so I belive) MySQLdb uses a lot of memory. If I execute a much smaller query (some bytes) the memory is not freed even with extensive use of close() and del on the connection and the cursor. I think I tried all combinations of del and close().

    Thanks in andvance
    Christian

     
    • Andy Dustman

      Andy Dustman - 2001-04-23

      0.3.5 and earlier versions have a reference count cycle related to the connection object. This is fixed in CVS. This may or may not fix your problem. The default Cursor class stores the entire result set on the client side. If your result set is big, you will use a lot of memory. An alternate solution is to use SSCursor, i.e. create the connection with the cursorclass=MySQLdb.SSCursor parameter. This fetches row by row (result set stored in the server). Note that you can have only one open cursor at a time with this class.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.