Antoine Pitrou added the comment:
> Adding `import gc; gc.collect()` doesn't change the outcome afaict
Of course it doesn't. The memory has already been released.
"ru_maxrss" is the maximum memory consumption during the whole process
lifetime. Add the following at the end of your script (Linux):
import os, re, resource
print(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)
with open("/proc/%d/status" % os.getpid(), "r") as f:
for line in f:
if line.split(':')[0] in ('VmHWM', 'VmRSS'):
print(line.strip())
And you'll see that VmRSS has already fallen back to the same level as when the
pyc is not recompiled (it's a little bit more, perhaps due to fragmentation):
$ rm -r __pycache__/; ./python -c "import repro"
19244
VmHWM: 19244 kB
VmRSS: 12444 kB
$ ./python -c "import repro"
12152
VmHWM: 12152 kB
VmRSS: 12152 kB
("VmHWM" - the HighWater Mark - is the same as ru_maxrss)
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue24085>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com