LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to measurement file hangs memory

Has anyone noticed that Write to Measurement File vi uses an extreme amount of memory for large data acquisitions.  For my application, the PF usage is about 400MB at the beginning, then goes to 420MB or so, but soon after the Write to Measurement File vi starts up, it jumps up to 1.8GB.  When the vi finishes and nothing is running, the PF usage stays in the 1.6GB or so range.  Running this more than once or twice causes the "Out of memory" error message and the data is lost.  The only way to free up the memory again is to close LabVIEW completely, including the start screen.
Is there a way to free the memory up after it runs?
0 Kudos
Message 1 of 4
(3,339 Views)
Could you give us a bit more information?
  1. Are you saving to a binary or ASCII file (e.g. TDMS, LVM, or ASCII)?
  2. How big is "large" - 100,000 points, 100,000,000 points?
  3. Where is the data coming from?
  4. What data type is the data (DBL, I8)?
  5. Can you post the VI in questions?

Large data sets require careful handling in LabVIEW.  If you haven't done so yet, you may want to consider reading Managing Large Data Sets in LabVIEW.

0 Kudos
Message 2 of 4
(3,313 Views)
I can't post the actual code because too many variables are proprietarily named.  What it does do is not release the memory until LabVIEW is quit and completely closed.

0 Kudos
Message 3 of 4
(3,291 Views)
The LVM express VI was intended for small data sets, since it is, by default, an ASCII format.  As such, it converts the entire data set to ASCII in memory.  It is relatively efficient, but still makes a few copies of the data.  The ASCII format can easily take up much more RAM than the original binary values.
 
Due to memory optimization issues, LabVIEW tends to hold onto memory once it is allocated.  However, you can probably clear this by writing a one point array.
 
This also brings up a workaround to your issue.  Write the data in smaller increments.  For example, if you have 1 million points, write in 10,000 point or 1,000 point blocks.  You can set up the express VI to concatenate to the current file.  There is a known bug with this method - the number of points in the header will not be updated.
 
I would urge you to use a binary method, instead, however.  You can always use flat binary.  National Instruments recommends TDMS for new applications (this is an option on the LVM Express VI), although this option is only available for LabVIEW 8.2 and later (the earlier TDM format has performance issues similar to LVM).  For earlier LabVIEW versions, use NI-HWS, available from the driver CD.  If you would like more information on the binary file formats, let us know.
0 Kudos
Message 4 of 4
(3,275 Views)