Skip to content

Instantly share code, notes, and snippets.

@zed
Created November 25, 2013 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zed/7637011 to your computer and use it in GitHub Desktop.
Save zed/7637011 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
"""Try to cause memory error due to subprocess' fork/clone behaviour.
It should produce:
OSError: [Errno 12] Cannot allocate memory
http://stackoverflow.com/questions/20111242/how-to-avoid-errno-12-cannot-allocate-memory-errors-caused-by-using-subprocess
"""
import subprocess
s = 'b' * 3200000000
subprocess.check_call("doesn't matter")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment