Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
3 ratings:
 4.33 out of 5     Rate this Document

How Can I Optimize the Memory Use in My LabVIEW VI?

Primary Software: LabVIEW Development Systems>>LabVIEW Base Package
Primary Software Version: 7.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I am building a large VI and I want to optimize my computer's memory usage. What guidelines should I consider when building my VI?

Solution:
The following list provides some guidelines to consider when creating a VI. Though they are by no means the only concepts to consider, they do represent a starting point for optimizing memory use.
  • Whenever practical, break VIs into subVIs. LabVIEW can reclaim subVI memory when subVIs are not executing.
  • Limit the use of global and local variables. Using global and local variables causes LabVIEW to generate copies of the data in the variables.
  • Display large arrays and strings on open front panels only when necessary. Indicators on the front panel retain a copy of the data which they display.
  • LabVIEW uses information from the control panel to determine optimizations that can be made.  If you need to place arrays on your front panel, wiring them to the connector pane may reduce the number of buffer allocations that are made.  Use the show buffer allocations tool to see where buffer allocations are made.
  • Property Nodes cause the front panel of a subVI to remain in memory, which increases memory use. Therefore, if the front panel of a subVI is not displayed, do not leave unused Property Nodes on the subVI.
  • Use consistent data types for arrays and watch for coercion dots when passing data to subVIs and functions. When LabVIEW changes data types, the output is a new buffer.
  • When designing the block diagram, be aware of any areas where the size of an input is different from the size of an output. For example, frequently increasing the size of an array or string generates copies of data which increases the number of memory allocations LabVIEW must perform. This can fragment memory.
  • Disable Allow Debugging in the subVI execution properties.
For more information on improving the performance of your LabVIEW VI, refer to the resources linked below.

Related Links:

LabVIEW Help: VI Memory Usage
NI Developer Zone: LabVIEW Performance and Memory Management
NI Developer Zone: Optimizing LabVIEW Applications
KnowledgeBase 2ZHD73IP: How Do I Use the VI Profile Window?
KnowledgeBase 2XQEOODT: Determining When and Where LabVIEW Allocates a New Buffer
LabVIEW 8.6 Help: Disable Debugging Tools



Attachments:





Report Date: 01/10/2003
Last Updated: 07/27/2009
Document ID: 2T9ICKTL

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit