Skip to main content

Memory leak in ibm_db.fetch_assoc

· One min read

I had a really frustrating time yesterday, trying to sort out some bugs in IBM's ibm_db DB2 driver for Python. Unfortunately I don't know Python well enough to know whether the bugs are in the ibm_db driver, Python, or my misuse if either or both :( But what I can tell you, is that the following Python / ibm_db code results in a definite memory leak.

sql = "SELECT filename, data FROM files WHERE id = ... ";
stmt = ibm_db.exec_immediate(conn,sql);
row = ibm_db.fetch_assoc(stmt);
row.clear(); # Just to be sure.
ibm_db.free_result(stmt);

I've started a discussion on the memory leak issue over at the ibm_db group (on Google Groups), so it will be interesting to see what transpires :) But all I can say at this stage is this: IBM's ibm_db DB2 driver for Python seems only half baked, currently. To be fair though, it is still officially in Beta.