How to Clear RAM Memory Cache on NI Devices with the NI Linux RT

Updated Oct 24, 2020



  • CompactRIO Controller


  • LabVIEW


  • NI-RIO

Operating System

  • NI Linux Real-Time

I'm using NI's sbRIO-9627 device and doing data logging on it. To prevent memory overflow, I would like to periodically clear the cache memory of the sbRIO-9627. 

Since the NI sbRIO-9627 ships with the NI Linux RT, you must first set sudo permissions before applying the cache memory clear command. By default, the access ID for NI devices running NI Linux RT is lvuser. And since this lvuser does not have permission to enter and apply various commands in the NI Linux RT, you need to grant lvuser the sudo privilege of Super User Do. Then enter the cache memory clear command  Echo 3 | sudo –I tee /proc/sys/vm/drop_caches to the NI Linux RT. Below is the procedure for the foregoing.
  1. Enable the target's SSH in MAX. And then, Remotely access the NI Linux OS Shell using PuTTY. You can find step-by-step instructions on how to achieve this: How Do I Enable the Console Out on CompactRIO, Single-Board RIO, CompactFieldPoint Controllers?​ 
  2. Login with admin ID, and leave password blank if not set.
  1. Install opkg. Enter the following two commands in order to proceed with the installation.
  • opkg update
  • opkg install sudo sudo-doc sudo-locale
  1. Access sudoers file through PuTTY. The default path is /root/etc/.
  1. Add lvuser permission in the sudoers file using the vi text editor. root ALL = (ALL) Add the following command below the ALL line.
  1. vi text editor Use the: wq command to save the sudoers file and exit the vi text editor.
  1. Enter the  command using System in LabVIEW. Note the snippet below, and the vi must run under the target.
  • Echo 3 | sudo –I tee /proc/sys/vm/drop_caches
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.