09-28-2020 01:01 AM
Hi
From my point of view this has been solved a long time ago but I am not 100% sure.
I think from LV2011+++ it was solved, but i did not make a test in the last few years.
09-28-2020 03:49 AM - edited 09-28-2020 03:50 AM
Check your refnums!!! If you create a refnum and pass it to an object you still have to close it. That is because .NET uses refcounting for objects. Passing an object (refnum) to a method will increase its refcount and if you do not close the refnum, that object will remain in memory since the object itself will only release one refcount and the remaining refcount will keep it alive.
In the case of Neils example he did another potential but similar problem. Every time he initializes a timer he creates both a .NET Timer object and a user event refnum but he seems to have forgotten to post the diagram for the Destroy.vi method of his timer class where he closes both these refnums and makes sure he matches each Initialize.vi call with exactly one Destroy.vi call.
LabVIEW refnums use memory, and the underlaying .NET object too. Creating such objects without closing them dilligently will look like a memory leak but is simply proper operation. LabVIEW does exactly what you told it not to do!!