Skip to content

Instantly share code, notes, and snippets.

@bogdando
Last active October 2, 2019 12:41
Show Gist options
  • Save bogdando/43a6c5938c964fa4ee94f714e0638ee5 to your computer and use it in GitHub Desktop.
Save bogdando/43a6c5938c964fa4ee94f714e0638ee5 to your computer and use it in GitHub Desktop.
memalloc_wsgi_app.py
import gc
import numpy
import sys
import threading
def application(environ, start_response):
class mydata(object):
_data = numpy.zeros(1000000000, dtype='uint8')
pass
status = '200 OK'
output = u'mod_wsgi.process_group = %s' % repr(environ['mod_wsgi.process_group'])
response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))]
start_response(status, response_headers)
d = mydata()
gc.collect()
return [output.encode('UTF-8')]
# back to idle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment