TDMS Write Memory Growth

Updated May 3, 2018

Reported In

Software

  • LabVIEW Full
  • LabVIEW Professional
  • LabVIEW Base

Issue Details

My memory (RAM) usage grows slightly each time the TDMS Write VI executes. Is this a memory leak, and how do I prevent memory usage from increasing?

Solution

There are a few possible solutions to the issue:
  1. If you are using the standard TDMS APIs to write data to multiple channels at a time, you must write the same number of data values to these channels in the same order.
  2. Set the NI_MinimumBufferSize property on channels before logging to the TDMS file. An example of setting this property is attached as Minimum Buffer Size Example.vi. This should decrease the speed of memory growth. Refer to the LabVIEW Help for more detailed information.
  3. If you are logging data continuously for an extended time, National Instruments recommends that you split the logging session into multiple shorter sessions. For example, you can write the data to multiple TDMS files by logging the data to a new TDMS file every hour. Using shorter logging sessions can help reduce the memory growth.
  4. After the whole logging session completes, you can defragment each TDMS file and then combine them into one large file. 
  5. Upgrading the TDMS component to the latest version can mitigate memory growth but does not completely eliminate this issue.

Additional Information

With the standard TDMS API, the TDMS Open VI opens the TDMS file for reading and writing. As you write data to your TDMS file, the TDMS API keeps a cache in memory that makes it easier to randomly access data within the file.  If you have an application that continually logs data to disk using TDMS, this may present as a memory leak. 

WAS THIS ARTICLE HELPFUL?

Not Helpful