I am writing an OPC client, so I use the OpenOPC Python library.
The problem is that every time I read the list of OPC items, my application consumes memory.
For example, the following code consumes about 100ko at each iteration:
import OpenOPC
import time
import gc
gc.set_debug(gc.DEBUG_LEAK)
client = OpenOPC.client()
while True:
client.connect('CODESYS.OPC.DA')
dataList = client.list("PLC2.Application.GVL.*")
res = client.read(dataList)
client.close()
print gc.collect()
print gc.garbage
time.sleep(2)
and the garbage collector returns:
0
[]
Memory is freed when you close the application.
So, I do not understand why my application is leaking memory and how to avoid this.
Do you have any ideas? Thanks
source
share