Python program eating up RAM

Most of your RAM is free for applications, because it's used for the buffers and caching. Look at the "-/+ buffers/cache:" line to see the amount of RAM that is really used/free. An explanation can be found here.

To verify wether Python is leaking memory, monitor that python's RSS size (or %mem) over time. E.g. write a shell-script that is called from a cron job every couple of hours to append the output of your ps command chain and the output of the free command to a file.

If you find that the Python processes are leaking memory there are a couple of things you can do;

  • Modify your script to that it extis after 24 hours and use a e.g. a cron job to restart it (the easy way out.)
  • Take an in-depth look into Python itself and expecially into the extension modules you're using. Use the gc module to monitor and influence the memory usage. You can e.g. call gc.count() regularly to monitor the amount of objects marked for collection. You can call gc.collect() explicitly and see if that reduces memory usage. You could also modify the collection threshhold.

If Python's RAM use doesn't increase over time, it could be another program of daemon. The memory logging script that I mentioned above should tell you which one it is.

There could also be another reason that your computer freezes. Look at the Linux logfiles for clues.

Edit: Since you have wpa_supplicant filling up the log file, you should check the state of the filesystem(s). A full filesystem might cause the system to hang. If you aren't using the wireless interface, disable it.