LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I create a refnum from a path?

A DAQ vi written to save 15 channels of data (sampled at 20kHz) and display each waveform on a chart runs for approximately 8 hours. I am assuming that I have a memory leak somewhere in the program.

A new output file is created each minute to protect written files in case of hard disk or windows errors. The output file is created, its path being sent to other portions of the vi. The files are never closed. The vi must run without error to be of any use, and must run for at least a day to be remotely useful.

And so to go back to the original problem: To use the close vi sub-vi, I need a refnum, not a path. Is there a convertion from path to refnum (a sub-vi is available for the opposite conversion)? Or is there another way
to do so (if fixing this problem of not closing will be of any use to me)?

Thank you.
0 Kudos
Message 1 of 4
(3,494 Views)
If you want to close a VI, use the "Open VI Reference" function in the "Application Control" menu. You can then use Property Nodes or Invoke nodes (also from the Application Control menu) to control the VI.

If your problem is data files, you might consider flushing your write buffers once in a while (File I/O->Advanced->Flush File) or simply close and open again. If you need the data file refnum from when you opened it, your solution may be to store it in a global variable.

Martin
0 Kudos
Message 2 of 4
(3,494 Views)
I made a slight error in my problem description. I want to use the Close sub-vi, as in close file, not close vi. So thank you for your suggestion.

My problem could be with the data files (seems by overnight testing that there is a LabVIEW memory leak somewhere, and since my vi is so large, it will be very difficult to pinpoint). So thank you for the flush advice. I will see what it will do.
0 Kudos
Message 3 of 4
(3,494 Views)
> My problem could be with the data files (seems by overnight testing
> that there is a LabVIEW memory leak somewhere, and since my vi is so
> large, it will be very difficult to pinpoint). So thank you for the
> flush advice. I will see what it will do.

Each time you open a file from a path, you get a unique refnum, so the
answer is no, you cannot go from a path to the original refnum. The key
is to make each section of code close its own resources, so the file
code currently leaving the file open, should close it at the appropriate
time.

Greg McKaskle
Message 4 of 4
(3,494 Views)