jesseruth / pyev

Automatically exported from code.google.com/p/pyev
0 stars 0 forks source link

possible memory leak? #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have a loop that is being called repeated with EV_NONBLOCK/EV_ONESHOT,
with an Idle watcher that is setup like so:

def loop_idle(watcher, pyevents):
    watcher.stop()
    pyev.sleep(.01)
    watcher.start()

watcher_loopidle = pyev.Idle(loop_handle,loop_idle)
watcher_loopidle.start()

I have noticed that after a while, the memory is increasing by 4 with
regularity, even when there are no other incoming watchers/events:

13.7  1.7  13984  8576 pts/1    S+   11:30   0:03 python run.py
12.7  1.7  13984  8580 pts/1    S+   11:30   0:03 python run.py
11.8  1.7  13984  8584 pts/1    S+   11:30   0:03 python run.py

As soon as I comment out the idle watcher, the memory usage stays the same.

This could definitely be a problem in libev rather than pyev, but
unfortunately this python project is the only instance in which I'm using
libev, so thought I would mention it.

Original issue reported on code.google.com by ski...@gmail.com on 6 Dec 2009 at 10:42

GoogleCodeExporter commented 9 years ago
Hi,

Can you provide more details?
Which version of pyev, python?
I'd also like to know if you can reproduce with trunk (if you have the time).

thanks for the report,

malek

Original comment by lekma...@gmail.com on 7 Dec 2009 at 8:18

GoogleCodeExporter commented 9 years ago
I'm really sorry, but I can't reproduce the behavior you're seeing (but I can 
only
test with trunk atm).
Can you provide a more detailed example that triggers the leak.

Original comment by lekma...@gmail.com on 7 Dec 2009 at 11:03

GoogleCodeExporter commented 9 years ago
I'm using python version 2.6.3. My pyev.__version__ is '0.5.0-3.8'

The following program is able to reproduce the bug for me:

test.py:

import pyev

loop_handle = pyev.default_loop()
def loop_idle(watcher, pyevents):
    watcher.stop()
    pyev.sleep(0.01)
    watcher.start()

if __name__ == "__main__":
    watcher_loopidle = pyev.Idle(loop_handle,loop_idle)
    watcher_loopidle.start()
    while True:
        loop_handle.loop(pyev.EVLOOP_NONBLOCK)

ps outout:
  1.0  0.6   6700  3212 pts/3    S+   01:31   0:00 python test.py
  0.8  0.6   6700  3216 pts/3    S+   01:31   0:00 python test.py
  0.6  0.6   6700  3216 pts/3    S+   01:31   0:00 python test.py
  0.5  0.6   6700  3220 pts/3    S+   01:31   0:00 python test.py

Original comment by ski...@gmail.com on 8 Dec 2009 at 12:33

GoogleCodeExporter commented 9 years ago
Ok, found it.
I'm working on a fix.

Again, thanks for the report.

Original comment by lekma...@gmail.com on 8 Dec 2009 at 10:09

GoogleCodeExporter commented 9 years ago
should be fixed in trunk.

can you test?

Original comment by lekma...@gmail.com on 9 Dec 2009 at 9:20