-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
It's not really evident on platforms with more than 128 MB of memory, but a few things in repy.py and safe.py are less than efficient when dealing with memory, at least transiently. (I will use this issue to talk about these problems overall, and probably add specific sub-issues for the different parts that are affected).
The startup process of a Repy sandbox works like this. (When started through the nodemanager, the callargs will differ a little, but the process is unchanged.)
- Repy initializes, then forks resource manager and the actual sandbox. --- Better fork early while the process isn't that large yet, then init sandbox in child only. (See also
nmmainself-daemonizing is memory inefficient nodemanager#117). safe.pywhich is called by the sandbox serves three mostly separate purposes:- Static code analysis (catches
print, illegal var names) - Actual runtime execution
SafeDict
- Static code analysis (catches
safe.pyPopen()s another process forsafe_check.pywhich in turn importssafe, of which it only needs the static-checking part.safe.py's_check_nodeis tail recursive, but Python does no elimination, and so the call stack can grow large. --- Do breadth-first instead, visit children etc. of nodes later.
I'm working on these issues one by one and will report what the memory savings are for each.
Metadata
Metadata
Assignees
Labels
No labels