I need to optimize the RAM usage of my application.
PLEASE spare me the lectures telling me I shouldn\'t care about memory when coding Python. I have a memory problem be
Redis would be a great option here if you have the option to use it on a shared host - similar to memcached, but optimised for data structures. Redis also supports python bindings.
I use it on a day to day basis for number crunching but also in production systems as a datastore and cannot recommend it highly enough.
Also, do you have an option to proxy your app behind nginx instead of using Apache? You might find (if allowed) this proxy/webapp arrangement less hungry on resources.
Good luck.