#290 Memory leak

MySQLdb-1.2
closed
MySQLdb (285)
5
2012-09-19
2009-09-11
Bjoern Thorwirth
No

When i execute the attached test case the interpreter grows to ~500 MB and stays there. shouldn't the memory been freed? pyodbc+mysql frees the memory imidiatly. This applies also to version 1.2.3.*

Discussion

  •  
    Attachments
  • sevenj
    sevenj
    2009-10-14

    it is not mysql-python's memory leak. It is python's memory leak! in python, it will cache the int,string(see python's source). so in your testcase, python would cache all strings(although in this testcase,all strings are same,but python don't know this). but I don't know why pyodbc free the memory. please upload the pyodbc testcase!

     
  • sevenj
    sevenj
    2009-10-20

    sorry, there are some error! In this test case python not cache string, but because of the python memory pool, it keep the memory.

     
  • sevenj
    sevenj
    2009-10-28

    In python, python has itself memory pool. when small object (<= 256) , python will use memory pool, big object direct use malloc. so when use small object, python will 'cache' it; use big object , glibc will 'cache' it.