Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

Commit

Permalink
Disable memory limit if not supported by the OS
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Jan 21, 2013
1 parent c6def35 commit ff05a6a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sandbox/config.py
Expand Up @@ -5,6 +5,11 @@
import sys
from sandbox import (DEFAULT_TIMEOUT,
HAVE_CSANDBOX, HAVE_CPYTHON_RESTRICTED, HAVE_PYPY)
try:
# check if memory limit is supported
import resource
except ImportError:
resource = None

_UNSET = object()

Expand Down Expand Up @@ -81,7 +86,10 @@ def __init__(self, *features, **kw):
self._use_subprocess = kw.get('use_subprocess', True)
if self._use_subprocess:
self._timeout = DEFAULT_TIMEOUT
self._max_memory = 250 * 1024 * 1024
if resource is not None:
self._max_memory = 250 * 1024 * 1024
else:
self._max_memory = None
# size in bytes of all input objects serialized by pickle
self._max_input_size = 64 * 1024
# size in bytes of the result serialized by pickle
Expand Down

0 comments on commit ff05a6a

Please sign in to comment.