Menu

#167 Memory leak on Windows

v2.7
open
5
2015-02-05
2014-08-05
Moy
No

Hi,

I'm developing a program using PySerial on Windows 7 Pro (32b) and GNU/Linux Raspbian.
On Raspbian, everything is ok, but on Windows, after a simple read call, the garbage collector indicates the following message :

gc: collectable <tuple 01912A50>
gc: collectable <StgDict 019196F0>
gc: collectable <_ctypes.ArrayType 019ABF10>
gc: collectable <getset_descriptor 0198EDF0>
gc: collectable <getset_descriptor 0198EDC8>
gc: collectable <tuple 018F4D20>
gc: collectable <getset_descriptor 0198EDA0>
gc: collectable <getset_descriptor 0198ED78>

Here is the test code :

import serial
import time
import gc

gc.set_debug(gc.DEBUG_LEAK)
gc.enable()

ser = serial.Serial("COM12", 57600, timeout = 0)

while True:
    if 1 <= ser.inWaiting():
        print ser.read(1).encode("hex")

    gc.collect()
    del gc.garbage[:]

    time.sleep(1)

For each call of read(), this message is duplicated with various addresses and the memory is
growing, slowly...
This is a known problem ? Something I do is wrong ? (I'm using Python 2.6.6 and PySerial 2.7)

Regards

Discussion


Log in to post a comment.

Monday.com Logo