06-26-2012 02:32 AM
Looping is not a problem. But whenever you get an ActiveX refnum, either explicitedly open it by Automation Open, or implicitedly by reading a property or executing a method that returns a greenish wire, you do have to close that refnum after use. So if you read a property that returns a refnum inside a loop, you need to put a Close Refnum node inside that loop too.
06-26-2012 07:02 AM
Agreed Rolfk,
But sometimes we either don't realize we did not close the refnum or someone else wrote it. We are left with a leak. I was tring to figure out what was the best way to see if we had a leak with a program that uses ActiveX heavily. One of my thoughts is to use Process Explorer and look at the labview handle counts. I havent done it yet, but it sounds like it may work. I am looking for other methods. I dont think memory profiler would work, because it is a memory leak ... and an ActiveX event.
Chuck
06-26-2012 07:38 AM
Well if you don't see any problems I wouldn't necessarily worry to much in the beginning. Don't fix a running system :-).
However if you notice the application continously increasing memory consumption then the Process Explorer is definitely a good indicator the get it more specifically nailed down. The overal memory consumption of a Windows system can of course vary but if you don't start and stop new applications continously you should see the system settle down after some minutes of continous operation. If it doesn't and the memory consumption keeps increasing you have a first indicator. Then the handle number can give you an even clearer idea. Once you know you have a memory condition in your system you will have to dig for it, and there are no general purpose tools to make that more automatic. It usually boils down to digging into the code, although a good first approach is to disable various parts in your application to isolate the cause to a smaller subsystem. If the application is written modularly, this should be not to difficult to do, without the need to change significant parts of the code.