Mike Le Posted February 4, 2015 Report Share Posted February 4, 2015 Hi guys, So I have an application that uses TDMS for data-logging. There's a continuous memory leak as I write new data. It's alleviated somewhat by setting disk cache high for each channel, but as I'm acquiring data continuously over long periods of time, this isn't a great long-term solution. I've tried switching over to the Advanced TDMS palette, but I'm having a lot of trouble getting an implementation going. A single TDMS file is accessed concurrently by multiple processes. Ideally, I want each process to open its own reference to the file. This wasn't a problem with the standard TDMS palette, but I'm getting errors with the Advanced palette. For example, error -2539 states: "LabVIEW: This file cannot be written to, because it is opened and locked by another thread or process. This typically happens when a file is written by a hardware driver, for example NI-DAQmx." Is concurrent access not allowed in the "Advanced" palette? Or do I need to do additional work in the Open step to allow concurrent access? Quote Link to comment
PiDi Posted February 5, 2015 Report Share Posted February 5, 2015 Let's make some (very) basic troubleshooting: have you used Advanced Open with "enable asychronous?" = TRUE? And then used VIs from TDMS Advanced Asynchronous Pallete to read/write in all your processes? Quote Link to comment
hooovahh Posted February 5, 2015 Report Share Posted February 5, 2015 You wouldn't happen to be writing 2D data and performing a transpose before the write? And on version I think 2011 or older? http://forums.ni.com/t5/LabVIEW/WARNING-TDMS-memory-leak-in-LV-2010/td-p/1874575 That was a nasty one that got me all the time. If you can isolate it like that user we can get NI working on it, or testing it on different versions of LabVIEW. What version are you using for this by the way? Quote Link to comment
Jordan Kuehn Posted February 5, 2015 Report Share Posted February 5, 2015 You wouldn't happen to be writing 2D data and performing a transpose before the write? And on version I think 2011 or older? http://forums.ni.com/t5/LabVIEW/WARNING-TDMS-memory-leak-in-LV-2010/td-p/1874575 That was a nasty one that got me all the time. If you can isolate it like that user we can get NI working on it, or testing it on different versions of LabVIEW. What version are you using for this by the way? I've nearly abandoned TDMS for these reasons except for in special cases. Quote Link to comment
hooovahh Posted February 5, 2015 Report Share Posted February 5, 2015 I've nearly abandoned TDMS for these reasons except for in special cases. It has issues for sure, but it is my preferred file format for the majority of the test software I write. And NI keeps investing in it. It seems every version of LabVIEW has some new TDMS functions under the advanced palette. Few I actually use but still. Quote Link to comment
Mike Le Posted February 6, 2015 Author Report Share Posted February 6, 2015 That was a nasty one that got me all the time. If you can isolate it like that user we can get NI working on it, or testing it on different versions of LabVIEW. What version are you using for this by the way? No, I'm trying to write each channel separately as a 1D array, using the "Set Next Write Position" function to select channels. I'm using 2013SP1. Let's make some (very) basic troubleshooting: have you used Advanced Open with "enable asychronous?" = TRUE? And then used VIs from TDMS Advanced Asynchronous Pallete to read/write in all your processes? Yes, asynchronous is set to True and I'm using the Advanced palette for all subsequent read/writes. For now I've given up on trying to use multiple references and am just trying to get a single reference to work. Even here I'm running into problems. I'm using the Advanced TDMS palette to create an on-disk circular buffer. I was able to successfully implement the buffer for a single channel of data. However, when I try to write multiple channels of data, I continuously get "End of File Encountered" error 4. I am pre-allocating 60,000 data points for each channel using the "TDMS Set Channel Information" function. I am able to (1) Set Next Write Position and (2) perform an Asynchronous Write to the first channel. But when I try to Set Next Write Position to the second channel, I immediately get an error 4. The examples have not been helpful as none of them write to different channels in sequence. Quote Link to comment
Mike Le Posted February 9, 2015 Author Report Share Posted February 9, 2015 (edited) Named WF Array Project.zip I created a project that demonstrates what I'm trying to do and the error. I'd really appreciate it if someone familiar with the Advanced TDMS palette could take a look. This was coded in 2013SP1. If you need it back-converted, let me know. Sorry about the file hierarchy, the project is located here: Workspaces\V12000\_V12000 Common Labview Code\Named WF Array\Named WF Array.lvproj Edited February 9, 2015 by Mike Le Quote Link to comment
eberaud Posted February 11, 2015 Report Share Posted February 11, 2015 Hi, I struggled quite a bit with it too but now everything works really nice, so let's see if I can help. There is a disable structure, should I look at the enable or disable case? In case it's the enable one, can you make a simplified version that has all the TDMS code in one VI and demonstrates what you're trying to achieve on the TDMS side only? Quote Link to comment
Mike Le Posted February 13, 2015 Author Report Share Posted February 13, 2015 Look just in the enabled case. I actually did try making a simplified version but I couldn't get the error to occur there. So there's something slightly more subtle going on with the actual implementation. Quote Link to comment
eberaud Posted February 13, 2015 Report Share Posted February 13, 2015 (edited) Unfortunately I didn't manage to dig deep into your code since a lot of it is beyond the scope of TDMS. However here is how my architecture works, in case it can inspire you: Writer side: Create file withDisable Buffering = False Asynchronous = False (I use Synchronous R/W) Set Channel Information (couldn't find this one on your diagram but again I didn't look everywhere)Channel names : the number of rows my 2D Array has in a write operation Samples per channel = how many samples for each channel at each write operation (number of columns my 2D Array has) Write using a 2D array that I don't need to transpose since it's built to have channels = rows and samples = columns (Advanced Synchronous Write) Reader side: Open file withDisable Buffering = False Asynchronous = False (I use Synchronous R/W) Operation = Open (read-only) --> I think this is where you'll get an error if you don't open it in read-only Read data usingSet Next Read Position Advanced Synchronous Read Edit: and of course both the reader and writer can perform their tasks on the same file simulateously Edited February 13, 2015 by Manudelavega Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.