Edit your wsgi.py file to wrap your application
object as shown in the attached example.
Then go to /__guppy__
to see memory usage profiling.
This is very basic and probably needs to be refined.
www: | |
type: python |
guppy |
def application(environ, start_response): | |
start_response('200 OK', [('Content-Type', 'text/plain')]) | |
yield 'Hello World\n' | |
def wrapped_application(environ, start_response): | |
if environ['REQUEST_URI'] == '/__guppy__': | |
from guppy import hpy | |
data = hpy().heap() | |
start_response('200 OK', [('Content-Type', 'text/plain')]) | |
return [ str(data) ] | |
else: | |
return original_application(environ, start_response) | |
original_application = application | |
application = wrapped_application |