Message242301
| Author |
pitrou |
| Recipients |
asottile, bukzor, pitrou |
| Date |
2015年05月01日.10:40:38 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1430476839.64.0.85039453938.issue24085@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年05月01日 10:40:39 | pitrou | set | recipients:
+ pitrou, bukzor, asottile |
| 2015年05月01日 10:40:39 | pitrou | set | messageid: <1430476839.64.0.85039453938.issue24085@psf.upfronthosting.co.za> |
| 2015年05月01日 10:40:39 | pitrou | link | issue24085 messages |
| 2015年05月01日 10:40:38 | pitrou | create |
|