LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

In-place overwriting of memory chunk by external libraries

So I got manual memory management to work (crashing LabView a few times before I figured out the exact right format for creating and reading memory blocks...). Code works much better now; besides the memory issues, I can now use some sane wire (and data) management. Instead of anywhere up to 11 (!) output terminals emanating from the setup routine, I only have four (1 or 2 buffers per channel, 4 channels, originally separate terminals for each but now a single array of clusters; also an error cluster and a couple of control/config lines).

 

Looking in more depth at the SDK code, I realized it was a near miracle that it worked at all. The snippet here is from the setup routine supplied by the SDK. 

 

picoscope setup snippet.png

(broken wire coming in from the left comes from a control setting the buffer size) Notice that there are two buffers associated with this channel; one is used internally by the driver routines (presumably to hold the data streaming off the device) and one is exposed to the application (data copied from the internal buffer as needed). In particular, note that from a LabView perspective the array emanating from the first DLL going into the second is entirely internal to this subVI, which means that a memory manager would be entirely justified in saying to itself "well, we're done with that chunk of memory, guess I can reuse it" as soon as the 2nd DLL call completes or at the end of the subVI execution. Of course, the rest of the library would cheerfully go on reading and writing to that block of memory that's being used for something else....

 

(Annoying software aside, the scope hardware is very nice. I'm working with the Picoscope 4262, which does 16 bit sampling with fairly low noise at up to 10 MS/sec on each of two channels (simultaneous sampling) and will stream one channel at full speed over a USB2 link for hours and hours at a time without any dropouts that I could see)

0 Kudos
Message 11 of 11
(541 Views)