LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Strange behavior when emptying long strings

The attached vi is supposed to clear a string indicator after its length becomes greater than a specified threshold length, with led indicators following the process.  It works fine at threshold 262268, but increasing it to 262269 causes it to periodically freeze.  The indicator lights do not update appropriately either.  Also if you set the threshold much higher, like around 1,000,000, the temporary freeze becomes even longer.  Is there a way to fix this?

Message Edited by AntLee29 on 05-16-2007 06:14 AM

Message Edited by AntLee29 on 05-16-2007 06:16 AM

Download All
0 Kudos
Message 1 of 12
(3,779 Views)

I am of the opinion, The reason for this may be size of your system memory (RAM)

0 Kudos
Message 2 of 12
(3,763 Views)
Well my system has 1.5GB ram.  Also I opened the task manager while the vi is running, and the available physical memory never drops below 950,000K.  Or is that the wrong way to check memory usage?

Message Edited by AntLee29 on 05-16-2007 07:05 AM

0 Kudos
Message 3 of 12
(3,761 Views)
Please read the following articles:
Managing Large Data Sets in LabVIEW
Why Do I Get "Memory is Full" in LabVIEW?

If you're really going to need to deal with such a long string you should preallocate the string rather than building it as you go, as the latter will cause LabVIEW to keep trashing around memory. I suspect, though, that a better approach is to rethink your method and come up with an alternative that doesn't require such a huge memory footprint.

0 Kudos
Message 4 of 12
(3,743 Views)
Hi AntLee,

this is NOT a problem of memory handling - you are playing with 256kB of memory, pretty easy for modern computers.
The problem comes from your LineFeed constant together with the string indicator!
If you replace the LF by a Tab constant your example runs fine even with a treshhold of 1000000 (one million).

So I suspect the string indicator has problems to show more than 262286 (~2^18) lines of text because of rendering all those line breaks - maybe NI should investigate this more deeply...

Message Edited by GerdW on 05-16-2007 04:38 PM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 12
(3,735 Views)
Good catch regarding the order of magnitude. I read the original post too fast and thought I was reading MB, not kB.
0 Kudos
Message 6 of 12
(3,728 Views)
Hmm so I guess it's just a Labview bug.  Thanks for the replies everyone!
0 Kudos
Message 7 of 12
(3,699 Views)
Each iteration of the While loop, the string is roughly doubled in length, since you are appending it to itself plus a few other characters (a number and a carriage return).  It jusst so happens that increasing the threshold from 262268 to 262269 means a string length of 262269 increasing to 524541, and of course setting it to 1000000means 1049085.  That is a lot of text to display on the GUI (which really would require much more than that many bytes since LV must draw all the RGB pixels).  You shouldn't be displaying that much text that quickly.  It runs quite easily without the display element.  If you wanted a SubVI to do this, as long as it's front panel is not displayed there would be no performance problem.  So I wonder if you need to display the string?
Message 8 of 12
(3,688 Views)
Hello All,

Thank you all for posting detailed information on this condition. Although I am not sure of a use case where you would display ~300000 lines in a string indicator, clearly there is an issue with updating front panel indicators when the string indicator is displayed; however, when there is no indicator displayed, it is not an issue.

I have filed this Corrective Action Request, ID 49MCRQXX.

Best regards,
-Sam F, DAQ Marketing Manager
0 Kudos
Message 9 of 12
(3,642 Views)
LV 7.1 does not freze or hang the computer, but definitely takes some more time to update the String when the threshold goes >262268
- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 10 of 12
(3,609 Views)