LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

binary file memory usage issue

Hi,

I am having major memory problems with the write to binary file VIs.  If I write a large arrays to a large number of files and keep the refnums open LabVIEW seems to keep copies of all the data in memory.  My PC quickly runs out of memory.

I tracked the problem down to the byte order that the data is written in, if it is the native byte order everything is fine, if not, it uses massive amounts of memory.  I understand that LabVIEW has to keep the data in memory while it converts it for writing, but after writing surely it should discard the memory.  This is really poor behaviour!  In the attached example memory_usage.vi, the memory used on my PC (Windows XP) goes from 34MB (native format) to over 180MB (network format).

Having isolated this problem I applied it to my application, only to find it still used all my memory!  This time I tracked it down to writing the data to the file in a cluster, see memory_usage_2.vi.  The write to binary file seems very very ropey!!

Be aware if you run my examples they will use alot of memory.

Has anyone seen this before, or suggest an reason why this is valid behaviour - before I submit it as a bug?

Tom


Download All
0 Kudos
Message 1 of 12
(4,354 Views)
Tom I agree that what you are seeing doesn't seem right.  I have filed a report so that it can be looked at by the File IO guys.
 
There is a "workaround" though I must admit I never thought I would suggest this.  Right after you do your write you can close and then re-open the file.  That seems to keep the memory where we expect it.  It doesn't really slow you down too much because in this case it works, rather than taking the computer to a crawl due to no memory.
 
Thanks for the report.
0 Kudos
Message 2 of 12
(4,345 Views)

Hi Tom

it sure is a bug make an entry in the breakpoint monthly bugs (april 2006) section

http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=2033

greetings from the Netherlands
0 Kudos
Message 3 of 12
(4,335 Views)

hello tom,

can you please post the VIs in 7.1?

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 4 of 12
(4,332 Views)
Same VIs in LabVIEW 7.1 attached....
Download All
0 Kudos
Message 5 of 12
(4,326 Views)

hm, to bad, can't run them with 7.1. some missing VIs and connectors... sorry i can't help.

good luck! 

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 6 of 12
(4,322 Views)
Sorry, that was a bit of a red-herring.  The first VI won't have any effect in LabVIEW 7.1 as there was no variable for byte order!

The second VI does have an effect in 7.1, but unfortunately there are memory leaks in both modes, just the rate of memory leakage (?) changes.

Tom.
0 Kudos
Message 7 of 12
(4,314 Views)
Beautiful ICON Chris a pity that this is not allowed in labview
wire is a member of a cycle.Insert Smilies
greetings from the Netherlands
0 Kudos
Message 8 of 12
(4,317 Views)

Somehow, I wonder if the current behavior is actually by design to improve performance under certain usage patterns?

Has anyone tried these on a big endian platform (Linux, Mac)? 


Albert Geven wrote:
Beautiful ICON Chris a pity that this is not allowed in labview wire is a member of a cycle.Insert Smilies
You just need to insert a feedback node ;). Or use a shift registers like in the example I made over a year ago:
0 Kudos
Message 9 of 12
(4,301 Views)
Someone from NI posted a comment a while back that the "endian" functions do not work right on Mac OS X. I ran the VIs on LV 8.0.0 and Mac OS X 10.4.6. One version was much slower (virtual memory swapping, I think) and used much more memory. The Profiler did not show the extent of the memory usage. One VI was about 800 KB and the other 2400 KB, while the Activity Monitor showed tens and hundreds of MB while the VIs ran. Does the Profiler only show code size?

Lynn
0 Kudos
Message 10 of 12
(4,296 Views)