Note that there are some explanatory texts on larger screens.

plurals
  1. POPython and MySQL mysterious memory leak
    primarykey
    data
    text
    <p>I'm running a python app that's querying (selecting) mysql db, reading ~1k rows at a time, performing calculations with them and repeating that for hours. Table which is read have ~20m readings and it's powered by MyISAM engine. MySQLdb connector is used to access MySQL from python.</p> <p>Problem is that after few hours all server's memory is used, leaving server with only 16mb memory available.</p> <p>First idea was memory leak in python app, but memory_profiler and dozer/dowser both showed that all variables are released properly.</p> <p>Next try to catch the leaker was taking process memory usage snapshot (ps vax | sort -k8n) before and after memory exhaustion.</p> <p>Snapshot (sorted by mem) when server had 280mb free (info from top): <a href="http://pastebin.com/0F3Wht0s" rel="nofollow">http://pastebin.com/0F3Wht0s</a> 2 hours later... Snapshot hen server had only 18mb free (info from top): <a href="http://pastebin.com/9MJkLX2g" rel="nofollow">http://pastebin.com/9MJkLX2g</a></p> <p>My surprise is that memory consumption of mysqld and statcalculator processes seams almost identical through time.</p> <p>I'm obviously missing something related to memory allocation in linux. How to see which process allocated that memory?</p> <p>Server is running Ubuntu Server 10.04, and has 1gb ram in total. MySQL and MySQLdb are from ubuntu repo. If any additional info is needed, I'll add here.</p> <p><strong>TLDR</strong>: Python app is constantly reading from mysql with selects. After few hours of this, memory is all gone, but top shows no increase in memory allocation for neither mysqld or python process.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload