SineQuaNon Posted January 29, 2007 Report Share Posted January 29, 2007 Hello! I have been struggling with a difference between LabVIEW 7 and 8 in how the Close Reference functions for Active X objects. In order to fully understand the problem, let me first explain the process of how I got here. I have an application in beta testing and we noticed a huge memory leak in LabVIEW 8, 8.2. I took a snippet of the code and worked on it a while to reduce the memory leak. I was closing every reference and could not explain it so I wrote the same code in VB and saw no memory leaks. I implemented the same code in LabVIEW 8 and still saw a memory leak. The code opens a graph control from a third party vendor and draws it. Each time the graph is drawn in LabVIEW 8, it costs about 30-40k. We have 8 graphs in our application bringing each iteration to 240-320k. The users are going to be reviewing between 96-384 samples in one sitting but we have no control over when the program quits. 384 samples reviewed in the graphs is 92,160k as a minimum. I was frustrated and about to send it to the thrid party vendor, AB Sciex, but they only had LabVIEW 7.1. So I converted it back to 8.0 and then to 7.1.1. I ran the code in 7.1.1 and there were little to no memory leaks! I even tried it in LabVIEW 7.0 and it worked the same as 7.1.1. I monitored the memory of LabVIEW through the task monitor in Windows XP. I have tried it on a few XP machines and a 2000 machine and same answer on all. I also built a Task Monitor tool using .NET to graph the memory of the LabVIEW process. I verified that running the .NET example as an exe and the windows based task monitor behave the same and produce the same result. So, I have an example that works in VB, LabVIEW 7.0 and 7.1.1. but 8.0 and 8.2 cause memory leaks! I have tried numerous things to force the removal of the references but nothing seems to have worked. Here is a list of things I have tried in LabVIEW 8 to force the closing of the reference: - Error detection after each property node/invoke node to catch any errors for the mem leaks - Deallocate Memory function is placed in every VI. - All VIs running in the User interface thread to avoid thread collision, also tried running in the IO thread. - Debugging turned off on all VIs. - All references converted to controls (instead of constants) and made not visible on the front panel. I hoped this would not force an update to the FP or memory. - All Open and Close references are in seperate SubVIs for memory deallocation. - Time delay of 3 seconds in between each property node/invoke node to make sure deallocation can occur. - Forced recompile and saved all. Rebooted in between all attempts and changes above. - Put all code and ocx control in a SubVI and called it through the main program as a SubPanel. I can see memory deallocation, but its not a full deallocation. It deallocates about 40k, but the load eats up 80-90k. VB and LV7 deallocate about 20k, increase 55k for the load, then drops 30k after the load and results in about 3-4k in memory for LabVIEW. I am hoping through this post that someone can help me out with understanding why LabVIEW 8 would handle closing references differently than that of LabVIEW 7. I feel as though i have attempted nearly everything I can to get LabVIEW 8 to work with this example. I have an open reference (ha thats funny) with NI to look at this but wanted to see if any of you had any thoughts? Thanks! Try it out for yourself here please.... LabVIEW 7.1 code (1.1MB) LabVIEW 8.2 Code (1.1MB) Third Party Program (77MB) Memory graph between LV7 and LV8 Memory Monitor Tool 8.2exe (770k) Thanks! Quote Link to comment
Yair Posted January 29, 2007 Report Share Posted January 29, 2007 Crosspost. When cross posting, it is considered polite to provide a link to the other thread to avoid having people waste their time if answers were already given. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.