Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
14 ratings:
 4.5 out of 5   

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

This document has been archived and is no longer updated by National Instruments



Primary Software:
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>LabVIEW Full Development System, LabVIEW Development Systems>>LabVIEW Professional Development System

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 that 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 2012 Help: VI Memory Usage
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 2012 Help: Disable Debugging Tools
LabVIEW 2012 Help: Choosing between Editor Responsiveness and VI Execution Speed



Attachments:





Report Date: 01/10/2003
Last Updated: 04/19/2016
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