Re:Diagnosing Memory “Leaks” in Python
by rdc12 on Tuesday September 08, 2015 @03:46AM
(#10184467)
Except under Linux fork() has COW semantics, so only heap variables that change will be copied, thou I suspect that could be a large portion of a Python process anyway
[ Parent
| on HN ]
Re:Diagnosing Memory “Leaks” in Python
by ThePhysicist on Tuesday September 08, 2015 @04:16AM
(#10184547)
Yes the operation is quite efficient, the problem is that fork() normally makes reloading of code (without resorting to special tricks) impossible, as the interpreter will usually already have loaded all imports before forking. The only way to circumvent this would be to delay the loading of required modules until after the fork.