I wanted to share with the group my recent experience with working with large string buffers, especially when working with the fast UDP communication. Perhaps somebody had similar problems and maybe that will help solving them.
When using LabVIEW to collect 20Mb/s from the UDP/IP network for a longer time I found that the limiting factor for the dropped data and performance is the ability for LabVIEW to cope with the received data. The UDP packet size has an effect so I tried to keep it large, but still it was just a band aid for the real problem.
Since LabVIEW does not have any memory allocation for strings in the beginning I simply added more string data and concatenate the strings. When the buffer reaches single MB I noticed that the UDP data is being dropped.
I suspected it has to do with the fact that LabVIEW needs to allocate a large memory for the growing and growing string, but when I started to search the net most of the advices were that LabVIEW does not need to allocate the memory for the strings.
Well, I found that it has to and not only to allocate the memory but to use the string circular buffer to feed the data into the ring and replace the old data in it.
Once I developed the circular buffer I have no more issues with the IP communication exceeding 20Mb/s with arbitrary packet sizes. It is very stable, takes minimal CPU time and is really working for me.
If someone is interested I enclose the vi files with example on how to use.
I'm currently also experimenting with high-throughput streaming via UDP and am getting packet drops, so I'm keen to give this a try.
Thanks for posting your experiences & code for others to learn from.
Thanks also to Steve for the conversion. Good job guys!