LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I free ram memory in daq assistant logging?

Hi.

I use DAQ assistant to acquire analog voltage. By using logging menu, I save the data in TDMS format. I want to change file name so I make a little change in DAQ assistant code, as you can see in attachment. But after a while, about 10 hours, my PC RAM memory in busy. How can I free this memory? I want to run my code for a long time without any interrupt!!!

Thanks

0 Kudos
Message 1 of 8
(3,252 Views)

Hey,

 

How do you know that it is the DAQ assistant that has a memory leak?

 

Try using the VI profiler to see exactly what is using all of your memory.  Tools>>Profile>>Performance and Memory...

 

This should give you a clear idea of what is using all of the memory.

 

You may also want to move away from DAQ assistants because every time it gets called it has to initialize, acquire and close.  If you move to using the lower level DAQmx functions, you only initialize and close once so it is more efficient.

 

 

 

 

Lewis Gear CLA
LabVIEW UAV

0 Kudos
Message 2 of 8
(3,220 Views)

Thanks Lewis G.

 

I am sure my problem is in this VI. And I am sure that the problem is in "DAQmx Configure Logging (VI)" because by removing this VI the RAM memory does not change size. I think logging in TDMS format is the problem. I insert "DAQmx Clear Task (VI)" at the end, as you can see in the attachment, and I get better result. Actually I am wondering why DAQ assistant does not have this module at the end?!!! But the RAM memory usage increase after 1 hour.
I have some questions:

 

1) How can I change the data logging file path every minute without stopping DAQ? I used property node and change the file path but it did not work!

2) How can I use "Write to Measurement File (VI)" for logging data with high speed? "Write to Measurement File (VI)" is very slow!!!

3) How can I free RAM memory? I use "Request Deallocation" but it did not solve my problem. Where should I put "Request Deallocation"?

4) What is your suggestion for logging analog data for long time without changing the RAM memory size?

 

0 Kudos
Message 3 of 8
(3,207 Views)

Hey,

 

1) You should implement a producer/consumer architecture.  This way you can have one loop focused on DAQ and another loop focused solely on logging to disk.

2) If it is not fast enough, you need to use the lower level File /IO functions.

3) Request Deallocation should not the answer to your problems.  You need to find out where and why you have a memory leak.

4) Any well programmed DAQ program should run forever. I can help you achieve this.

 

Can you upload your top level VI so I can see whats going on outside of the express VI you have attached.

 

It sounds like express VIs are not suitable for your application:

 

Caveats When Using Express VIs

Express VIs are designed for ease of use. If you need an application to run with strict memory restrictions or high execution speeds, use standard VIs.

Lewis Gear CLA
LabVIEW UAV

0 Kudos
Message 4 of 8
(3,200 Views)

Thanks again Lewis G.

 

Your comments are very helpful my friend. I am working on producer/consumer and I hope to solve the problem that way.

To be honest I don't know how to build a "lower level File /IO functions". Can your give me some links to learn that?

I really enjoy DAQ assistance module because it is very very simple but I now understand that it is not a solution to every thing!

Check the attachment.

Download All
0 Kudos
Message 5 of 8
(3,189 Views)

Hey,

 

For file IO, take a look in the LabVIEW example finder.  Help>> Example Finder

Browse under Fundamentals>>File input and output.

 

Why are you creating a brand new file every single time the loop goes around?  You must have thousands of files on disk? This is probably why you have a memory leak.

 

Usually when we perform file IO,  we open a single file, stream all the data to that file during the measurement and then close the file.

 

The express VIs may still be ok for you, if you use them in the correct way.

 

Kind Regards

Lewis Gear CLA
LabVIEW UAV

0 Kudos
Message 6 of 8
(3,174 Views)

Hi.
Sorry for my late answer. I solve RAM memory usage thanks to your help. I need to change the file for each minute because this code must to run for a long time and I want to see previous data any time I want. Is there any way to change the file path without stopping the DAQ assistant and starting again?

0 Kudos
Message 7 of 8
(3,143 Views)

Glad to here your memory issues are fixed.

 

You can change the file path without stopping the DAQ assistant just like you were before, by feeding a new file path into it.  When you feed a new file path in, a new file is created.  You may be able to do this every minute but certainly not every time the loop iterates like you were before.

 

If I was you, I would forget the logging functionality of the DAQ assistant and implement your own data logging. You could write some code that creates ONE file, and writes each line of data with a corresponding timestamp so you can see when the data was created.

 

If you convert the dynamic data type to Waveform data type then it includes timing information.  See this example.

 

You should keep all your data in one file, it is much easier to manage, analyze and search this way.

 

Kind Regards

Lewis Gear CLA
LabVIEW UAV

0 Kudos
Message 8 of 8
(3,123 Views)