Update 16 Mar 2019 Updated instructions.
Update 16 Oct 2018 There was a bug in pytracemalloc that prevents the PYTHONTRACEMALLOC environment variable from working. I have submitted a pull request and it is now merged. The PR fixed the bug in Python patches, added a testing script for the patches and improved the documentation.
Background My application is killed by the OOM killer. How do I find out why the application is taking up so much memory?