New submission from Cristian Martinez de Morentin <cmarti...@das-nano.com>:
Hi everyone, I have found a memory leak when using Queue and Condition from threading library. The issue can be reproduced with the following code: ======================================================== import queue import threading class MemoryTest(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.queue = queue.Queue() self.cv = threading.Condition() def put(self, msg): self.queue.put(msg) with self.cv: self.cv.notify() def run(self): while True: while not self.queue.empty(): self.queue.get() self.queue.task_done() with self.cv: self.cv.wait_for(lambda: not self.queue.empty()) ================================================================ If you run a MemoryTest object in another thread, by calling its start() method, and you send it messages by using its put() method, you will see how RAM memory usage starts increasing. This behaviour has been observed in Windows (64 bits) with Python 3.6, 3.7 & 3.8, but not with Python 3.5. Thank you so much. ---------- components: Windows messages: 369443 nosy: Cristian Martinez de Morentin, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Memory leak in threading library with Python 3.6-3.8 type: resource usage versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40699> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com