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

Error 2, LabVIEW: Memory is Full when Building a LabVIEW Executable

Primary Software: LabVIEW Development Systems>>LabVIEW Full Development System
Primary Software Version: 8.2
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Toolkits>>Application Builder

Problem:
I have a very large LabVIEW 8.20 or 8.2.1 application that I need to build into an executable application.  When I attempt to build the application, the build fails with either Error 2, LabVIEW: Memory is Full or Not Enough Memory to Complete this Operation.  I have plenty of available RAM, and I can build smaller applications without a problem.  Furthermore, I am able to build this same application in LabVIEW 8.0 or 8.0.1. Why does LabVIEW give either Error 2, LabVIEW: Memory is Full, or Not Enough Memory to Complete this Operation when I try to build my application?

Solution:
The LabVIEW Application Builder reports Error 2, LabVIEW: Memory is Full because it cannot find a contiguous memory space large enough to build a resource file before it moves the file into the executable.  This is not a bug in LabVIEW, but a limitation in the memory space available to a  single process on a 32-bit operating system.

You can work around this issue by building a smaller executable.  Build a smaller executable by bundling dependent subVI's and dynamic VIs into an external support LLB and distributing it with the built application.

  1. Add all dynamic and 1st level subVIs to the project.  Use the attached VI, "add subVIs to project.vi", to add all 1st level static subVIs to the project, but you must add dynamic VIs manually.
  2. Organize the newly added VIs in the project into a 1st Level subVIs folder and a Dynamic VIs folder.  The project should be organized similar to the project in Figure 1.  If you use the "add subVIs to project.vi" utility, then you may need to remove custom controls and type defs that may be automatically added to the project.

    Figure 1: Project Structure

  3. After you add all 1st level subVIs and dynamic VIs to the project, create or edit your application build specification.
  4. On the Source Files page of the Application Builder, move your top-level VI into the Startup VIs section and move the 1st Level subVIs and Dynamic VIs folders into the Dynamic and Support Files section.
  5. On the Desinations page, create a new destination called supportfiles.  Make the supportfiles destination an LLB by checking the Destination is LLB box.
  6. In the Source File Settings page, select the 1st level subVIs and dynamic VIs folders and then place a check mark in Set destination for all contained items.  Under Set destination for all contained items, select supportfiles.

    Figure 2: Source File Settings

  7. Make any further changes you need to the application properties, such as creating a custom application name, icon, or version number.  The key settings for working around Error 2 have already been made.
  8. Close the build specification.
  9. Save the project.
  10. Compile the application build specification.
  11. The application should now compile successfully.
This alternative method for building an executable will result in an executable much smaller than traditional methods.  This is accomplished by moving all the executable dependencies into an external support LLB.  Because the Application builder is not forced to place all the subVI's and dynamic VIs into the executable, LabVIEW should not run out of memory. 

The Application Builder will automatically update all static VI paths from the executable to the subVI dependencies in the support LLB.  You must exercise extra care to ensure that dynamic VIs are still referenced correctly because they will no longer be contained within the executable.  Use relative paths to point any dynamic VI calls from the top-level VI to their new location in "supportfiles.llb".

LabVIEW 8.5 Update: LabVIEW's internal process for moving dynamic and subVIs into an executable now uses a separate process, increasing the available memory space for the build process.  While this will help to avoid out of memory issues when building your application without using the workaround, there is still a possibility that building your application will return error 2 due to the memory limitation for each Windows process. In this case, you can either use the workaround mentioned above or adjust the Windows process memory configurations.  As of version 8.5, LabVIEW is large address aware, which means you can take advantage of the 3GB and PAE Windows memory configurations.  For more information, see the "Extending Virtual Memory Usage for 32-bit Windows" LabVIEW 8.5 Help topic.

Note: If this is not the source of your error, check the Related Links section below for further troubleshooting.



Related Links:
KnowledgeBase 3ZNDGRS9: LabVIEW "Memory is Full" Error
KnowledgeBase 2L5ER14I: LabVIEW Error 2 "memory is full" and/or Windows Error "not enough memory to complete this operation" when using TCP/IP in LabVIEW

Attachments:
add subVIs to project.vi




Report Date: 12/19/2006
Last Updated: 09/20/2007
Document ID: 44IHRE2F

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