LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Does storing the refnum value in a unintialised shift register take up a lot of memory?

Hi
I have attached a filed point driver vi with this mail. In the intialize case i have intialized the field point and stored the refnum in the shift register. so in the subsequent calls i could use this refnum with out intializing the FP everytime.
I would like to know whether this type of architecture going to keep on adding to memory every time I call the driver. What are the other options available to me to get the same functionality.
0 Kudos
Message 1 of 6
(3,406 Views)
Haven't used fieldpoint myself but storing references to opened drivers in shift-registers is what we normally do for a lot of different hardware. (If we don't just initialize/open outside the loop and then wire the reference into the loop...which would be the same anyway (the shift register in itself does not allocate continuosly). I would expect it to work fine in this case too.

If you are wondering whether there is a memory builup you could use the VI profiler or build an application and use the task manager to see if that's the case. If it is then it might be something else in your code though...try to disable / delete parts of the code temporarily to see if you can pin-point the source of the problem.
0 Kudos
Message 2 of 6
(3,406 Views)
Hi

Thanks for the details. But i have a few more doubts, in the VI i have attached i contantly update the shift register with the object handle out. Does this in any way pave way for the memory build up.

Further if want to clear an array which i had built, what function should I use.
0 Kudos
Message 3 of 6
(3,406 Views)
Constantly serving data to the right-terminal of the shift register is a requirement; the shift register is to hold the value from the previous iteration so it is required for it to get a value...the value overwrites the previous value, it does not allocate new memory for it.

Shift registers are one of the fastest and most efficient ways to store data in LabVIEW. Take a look at functional globals; they are based exactly on that fact.

If you build an array, hold it in a shift register -and then want to clear it just use a case that wires an empty array into the shift register when you want to clear it...On the other hand building arrays (using the build function) should normally be avoided - instead initialize the shift register with an array of t
he right size and then put new data into it using the replace array elements function. That way you are continously working on the same memory block.

If the description above does not match what you are doing attach a picture of the code in question and I'll take a look at it and see if there's any optimization possible.

Mads
0 Kudos
Message 4 of 6
(3,406 Views)
I haven't looked at your code, but ANY refnum is a simple 32-bit quantity - a reference to some other structure in LabVIEW's internals.

Storing the refnum in a shift register (initialized or not) is fast, memory-cheap, and an excellent way to make the refnum available to any frame in a sequence within the WHILE loop, or any CASE within the WHILE loop
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 6
(3,406 Views)
hi mads
Thank you. You cleared my doubts.
0 Kudos
Message 6 of 6
(3,406 Views)