Memory Reporting Issue with NI Linux Real Time OS Target

Updated May 10, 2018

Reported In

Hardware

  • CompactRIO Controller

Software

  • LabVIEW Real-Time Module

Operating System

  • NI Linux Real-Time

Issue Details

How should I monitor RAM usage on NI Linux Real-Time?

I have been using the System Property Node and Distributed System Manager (DSM) with my NI Linux Real-Time OS target but it is not correctly reporting the amount of free physical memory on my system.

I have been using the System Resources Property node and am getting error -2147220623 on my NI Linux Real-Time system.

Solution

To monitor a LabVIEW Real-Time Application, you can use the System Exec VI to run commands in the Linux shell. The command  cat /proc/$(pidof lvrt)/status | grep RSS returns the Resident Set Size of the LabVIEW process (Resident Set Size gives the amount of memory allocated to a process). Please note that this does not report total memory usage of the entire OS, which has its own memory consuming processes. This method of memory monitoring is primarily useful for detecting memory leaks.

You can try this by setting up a LabVIEW project with your NI Linux Real-Time OS device and creating a VI that resembles the block diagram below.
 
 

Additional Information

On NI Linux Real-Time OS targets, the Free Physical Memory Property Node of the System Configuration API along with the Distributed System Manager fail to give an accurate accounting of the free physical memory on the device. Memory management and reporting on Linux devices differs significantly from targets running operating systems such as Windows or VxWorks. It can be difficult to get a simple accounting of system memory usage due to how memory management and reporting is handled by the Linux OS.However, we can use the tools provided by the Linux OS to accurately monitor the memory usage on the real-time device. To get an accurate account of memory usage, we can look at the process on the device that uses the most memory. When we deploy a real-time application written using the LabVIEW Real-Time Module, we expect the LabVIEW process to use the largest amount of memory.

WAS THIS ARTICLE HELPFUL?

Not Helpful