![]() Sorry, 0.5 byte/loop is not a memory leak :-) Print("after", loops, "loops, mem:", c, "B") Print("after", loops, "loops, mem:", b, "B") Gc.collect() gc.collect() gc.collect() gc.collect() Timer = threading.Timer(0, spawn, (event,)) No memory leak if subprocess is spawned in a thread neither: Output on Fedora 24 (Linux) and Python 3.5: I'm unable to reproduce any memory leak on subprocess itself: If no-one else can reproduce it on their OSs/distributions, I'll seek advice from the Arch community. Wow, that is surprising (given how simple it is)! Did you try both tests? Remember that only the second one produces the bug here. If we are lucky maybe someone else will be able to reproduce it. It is surprising that Arch would have a different behavior than Gentoo in this context. I'm not sure what to suggest to you for further debugging this. For me it bumps up initially but then remains constant even if I let it run for many more probes than in your example. I can't reproduce this with either python3.4.3 or 3.5 or 3.6 tip running it on gentoo linux. It doesn't look like I can upload more than one at a time, so get ready for a few emails! Nonetheless, I will post the seven (7) files individually as well. Doing it that way makes it faster for you guys to run the tests at your end. I put them into an archive so that the folder hierarchy would be preserved. David Murray (r.david.murray) *Ĭould you post files instead of a zip, please? It will be easier to review. The situation isn't as bad as I first reported, but the memory does nonetheless keep increasing in the second case (which it probably shouldn't).Īuthor: R. Garbage collection seems to make the outcome slightly worse (in the second case). In the second, the presence of the loop is probably what throws a spanner in the works. The attached archive contains code samples and the output generated (both with and without garbage collection).Īs you can see, the memory stays constant in the first case. I've just run some further tests on this problem. Okay, I've modified the title to match what I've written below. The newly attached logfile was generated with the following code fragment.Īhhah, the title should say: subprocess module leaks 4kiB memory **per thread**. It's easier to reproduce the issue if you use a timer (rather than a loop). Let me know if you'd like me to run any other tests. I have attached the logfile for your convenience. ![]() I monitor it via the following Bash script: The memory footprint increases by roughly 4 KiB *each* time. ![]() I already have it in a loop a new shell command is fired every second. I wouldn't have reported this if it was only happening *once*. That the memory footprint increases *once* by 4KiB is nothing please run this in a loop. Let me know if you need any further information.ģ.5.1+ ubuntu I run the Popen case in while True, and watch `top` - not a single digit changes in the memory usage (the last digit being the kilobytes). I'm using Python v3.5.2-1 on Arch Linux it was installed via the repository. PTest = Popen("true", stdout=PIPE, stderr=PIPE) I've tested the problem with two different slices of code the result is the same in either case (long after the function finishes). Third test results - garbage collection enforcedĮach time I run a shell command via the 'subprocess' module, I notice that the memory footprint of my program increases by roughly 4 KiB. Third test results - no garbage collection Second test results - garbage collection enforced Second test results - no garbage collection Filesįirst test results - no garbage collectionįirst test results - garbage collection enforced The Compiler, Xavion, r.david.murray, vstinner, ztaneĬreated on 04:31 by Xavion, last changed 14:58 by admin. The 'subprocess' module leaks memory when called in certain ways
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |