Showing results for 
Search instead for 
Did you mean: 

real time TDMS memory leakage

Go to solution

Hi Lee, 


This is the expected behavior for TDMS Write in your application. Technically, this is not "leakage", this is memory usage increment, because if you use TDMS Close to close this file, the memory usage of the machine/target will be back to normal. The reason of the memory usage increment is that internal of TDMS, we need to keep some data structures for bookkeeping and while you write more and more data values, the internal data strucutre will also grow up. I understand the reason why you worried, and we also have a couple of walkarounds here:



  1. Use the property of "NI_MinimumBufferSize", you can find the detail information in TDMS Set Properties documentation and genenrally speaking this is a number to indicate how many data values of the channel accumulate and then flush to TDMS file, usually we can set it to a number from 1000 to 10000, and it would help to reduce the memory usage for TDMS writing.
  2. You can also use TDMS Advanced API on RT target as well, it's introduced in LV 2010 and it doens't have this memory increment issue.
Please let me know if you have any more question. Thank you!


Message 11 of 19

I found Advanced TDMS file writing has a bug.


 Look at the picture bug.png.

 When I run that VI, Logical And is True. (of course, the two array are same).


 Check bug2.png then you'll know what I meant.


 Same input data, but one is broken, one is OK. So random.


 Anyway, So If I keep open and close tdms, and open another tdms file....then It consume up my RT memory?


 My procedure is following.


 1. open tdms.


 2. write data about 10000samples per 5 seconds.


 3. keep writing 2 hours.


 4. close tdms and open another tdms, then repeat from 1.


 And then my memory is gone.


 I attach againg my memory status log file.


 You can see that last three times memory status is OK, I mean no more leak.


 I just can't understand.

Download All
0 Kudos
Message 12 of 19

I found why this is happening.


One is a "REAL" 1-D array, yet another is "Made from 2-D Array"

0 Kudos
Message 13 of 19

Hi Lee,


It's cool you find this "bug", TDMS Advanced Write doens't support "subarray", so you can find the wire is broken, but it supports "array". The workaround is quite simple, you can use "Always Copy" for the "subarray" before you wiring to TDMS Advanced Write.


I'm still confused how you generate the attached "Leakage.jpg", did you use any VI?

Message 14 of 19

Attacked VI is almost same what I made that picture.


Just keep tdms, write, close tdms..........


Thanks for your help & interest. 🙂

0 Kudos
Message 15 of 19

You are welcome. 


Oh, you mean you used the 2 RT VIs in your attached picture, and write the results in a TDMS file?

Message 16 of 19

Attached VI is running at my Real time target.


 I get result via FTP.


 Open tdms another VI run in my desktop and I see weird result.....


 As you see that I log data and also memory consumption.


 Then I get these patteren. Memory consumption like stepping up....

0 Kudos
Message 17 of 19

Hi Lee,


Sorry for the late reply, now let's try to narrow down the problem.


I would have the below suggestion:

Using the RT VI to record down the memory usage is a good idea, but please try to avoid write down the result into TDMS file. You could output the result directly in a waveform indicator or even TXT file. Firstly, do not use any TDMS node, just observe where there's any memory increment, and then using TDMS Standard API, to see what about the memory usage, and then using TDMS Advanced API to log the memory usage results.


Thank you,

Yongqing Ye


Message 18 of 19

I will try your suggestion.


Thanks a lot!

0 Kudos
Message 19 of 19