Profiling Django object size and memory usage with Pympler
A small middleware that profiles objects and memory used by code of requested viewPympler is a set of Python modules that can assist in profiling memory usage, or debugging memory leaks. It's a good tool for testing multi threaded network script-services, but you also can use it to profile Django views, especially if they use complex Python modules (generate PDFs, images, other). To profile a Django view we can use a middleware like this one: In settings.py we add this middleware to MIDDLEWARE_CLASSES and start the development server (if you have media files not in site_media - change the name in the middleware code). This middleware will GREATLY increase request processing. Here is an example result for my forum: If your view code leaks memory or is inefficient you will be able to determine that with asizeof, or heapmonitor (why I doesn't have this in my Pympler package?).