LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory Leak in cRIO running RT

Solved!
Go to solution

I am running 2009 RT on a compact RIO chassis.  My very basic VI causes the RIO to reboot which appears to be related to a memory leak.  I use the system monitor and can watch the memory usage on the RIO chassis grow very slowly.  Attached is the project and the target VI is pretty basic.  I even made the modification to close the refence that is opened during the data scan but still have this persistent problem.

0 Kudos
Message 1 of 10
(5,056 Views)

choff,

 

You didn't include all the sub vi's so I can't look at everything.  I did notice that one of the missing vi's is called "open module reference".  Make sure that you are closing all your references.  This is one of the most common causes of memory leaks.

0 Kudos
Message 2 of 10
(5,041 Views)

I cannot upload the "advancedscanengine_lv2009.zip" since it is too large for the forum.  It is available on NI site.  When I run the "data aquire" vi only on the target I can see the memory usage growing and the vi is so basic.  Thanks.

0 Kudos
Message 3 of 10
(5,032 Views)

choff,

 

So what does "Open Module Reference.vi" look like?

0 Kudos
Message 4 of 10
(5,029 Views)

I tried to attached the sub vis again.  These are NI products, not something I generated.  Thanks.

0 Kudos
Message 5 of 10
(5,019 Views)

Your attachment included 4 vi's.  You currently use 3 of these 4 in "support - acquire data.vi" .  You need to use the fourth vi titled "Close Module Reference.vi" .

 

Every time you execute the FOR loop you open a new module reference which you never close.  This is your memory leak.

0 Kudos
Message 6 of 10
(5,010 Views)

Actually, I did that modification last week, sorry I did not send you the latest version.  Even with  the close reference I am continuing to see a memory issue.

0 Kudos
Message 7 of 10
(4,997 Views)
Solution
Accepted by choff

choff,

 

The next thing I would look at is how you are using the "Allocate Array for Input Module.vi".  Based on the Help for this function and reading this , I don't think you are using this correctly.  I'm pretty sure that it is intended to use this function outside the main loop.  Your vi repeatedly calls it within the loop.  Every time you call it, it allocates another chunk of memory.

0 Kudos
Message 8 of 10
(4,988 Views)

Wayne,  I think you've nailed it.  Perhaps you can shed some light on one other thing for me.  I need to pass a cluster control from my host PC vi to the RIO vi and it appears that shared variables do not offer clusters?  Is there a way to use a global variable to pass between the PC and RIO?

 

Thanks!

0 Kudos
Message 9 of 10
(4,970 Views)

choff,

 

There is a way to pass a cluster using a shared variable.  I do this all the time.  Turn the cluster in question into a type def'd custom control and save in your project.  When you create a the shared variable you can select the Data Type.  Last thing on list is 'From Custom Control.....' 

 

P.S.  If that other post really fixed the memory leak then please mark it as the solution.  Somehow I don't think you'll be the last person to run into this problem.  Smiley Wink

0 Kudos
Message 10 of 10
(4,960 Views)