03-13-2007 03:53 PM
03-13-2007 04:22 PM
The answer may depend on whether the array wire coming into the "subset" function terminates there or whether it branches elsewhere. If it terminates, there's a chance that new memory needn't be allocated, though I can't say for sure that it won't. Some versions of LabVIEW have a menu option to "Show Buffer Allocations", but it seems that I've seen comments on these forums suggesting that those buffer allocation indicators aren't 100% accurate. On the other hand, if the array wire branches elsewhere it's at least very likely that you'll be allocating memory.
Can you describe a bit more about your app, your array and subset sizes, loop rate requirements, etc.? Sometimes you can rewrite your processing algorithms in ways that avoid memory allocation, though it can take a bit of work.
Example: suppose you want to take the same size array subset every RT loop. You could instead create a shift register on the loop to hold the array subset contents. On each iteration of the loop, you pass both the original full array and the shift register subset array into an inner loop. The subset array should go in through a shift register while the full array can go in via shift register or tunnel (it shouldn't matter). Inside the inner loop, you use explicit indexing to extract a value from the full array and use Replace Array Subset to put it into the subset array. When the inner loop is done, the subset array comes out the inner loop's shift register and goes into the shift register of the outer loop.
Definitely more complicated (and I didn't even cover the one-time special case of initialization), and usually slower, but should be very determinisitic due to lack of memory allocation. The reason this works is that the shift registers retain the data memory space between calls.
You might want to pose this kind of question on the RT board because I haven't dabbled with RT since version 6. The "rules" may have changed. Perhaps the memory manager can figure out how to optimize cases where the length input to Array Subset is a constant or something.
-Kevin P.