FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory leak with fieldpoint and labview

I have an application which is showing an issue of a memory leak.  The application does several things, but the part that seems to be causing the trouble is related to use of Fieldpoint VIs.  The application reads individual AI channels on a Fieldpoint AI-110 (10 channels, where the set of channels is measured once per second)  I have attached the code related to this.  The memory leak is quite large (~1.5GB in 24 hours of operation).
I am using LabView 7.1, and Fieldpoint 4.1.  The parent application which uses the attached code is a stand-alone application.  The operating system is Windows 2000.  Fieldpoint communication occurs over a RS-232 link.
 
Thanks in advance,
Andy
0 Kudos
Message 1 of 3
(3,268 Views)

Hi Andy,

I did not see anything fundamentally wrong with what you wrote, but there were a few things that I think could be used to be changed.  However, there were a few things that I did modify that might make a bit of a difference.  In your application you were using sequences and a bunch of local variables.  Since LabVIEW is based upon data flow, you can control the sequence of execution by making data dependencies and simply wiring one thing to the next.  By simply using LabVIEW the way it is meant to run I was able to completely remove the sequence structure and also eliminate the use of all of the local variables, all while having the exact same execution order. 

It could be that the local variables were causing the memory leak that you noticed, but I really doubt they could be the cause of such a large leak.  I really think there is probably something else going on in the application because from what I saw from this bit of code there really is no way that it would have such large problems.  Users use the FP commands daily without any problems, so most likely these are not the root of the problem.

Go ahead and try the modified code and see if you can implement similar local and global variable reducing techniques throughout your application.  Hopefully that will help reduce some of the memory leaks you are seeing.  Typically the largest cause of an apparent memory leak really occurs from building an array within a loop, so make sure you don't have any situations where that occurs in your code either.

Regards,

0 Kudos
Message 2 of 3
(3,255 Views)

Otis,

thank you for this update.  Prior to receiving your code, I rewrote my VIs such that they no longer use fieldpoint VIs (e.g., communicate directly via VISA serial VIs).  While changing only that, the memory leak has been resolved.  I'm attaching the code for that, if you are interested.

I should also mention, in case I hadn't already, in my application there are 4 sub-VIs which interact with fieldpoint modules.  Two of them simply measure voltage, using VI's like the ones I've attached, one of them sets relay modules, and the other sets analog output voltages.  They are all functionally very similar, so I would not expect any of them to act differently than the rest.

Thanks!

Andy

0 Kudos
Message 3 of 3
(3,239 Views)