Mahadev
Mahadev

Reputation: 856

System.OutOfMemoryException error while building Wix Project

I have a Visual Studio 2012 installed with Wix 3.9.1208.0 installed with it. I am trying to create a Bootstrapper by taking BootStrapper Project. Here is the code in Bundle.wxs.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle IconSourceFile="D:\logo.png"  Copyright="2015@Company Name"  Name="Product Name" Version="1.0.0.0" Manufacturer="Company Name" UpgradeCode="ef645195-36e9-4b99-8374-86f8445714d8">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
      <bal:WixStandardBootstrapperApplication
        LicenseFile="D:\License.rtf"
        ShowVersion="yes"
        />
    </BootstrapperApplicationRef>

    <Chain>
  <ExePackage Id="Framework" Name="Microsoft .NET Framework 4.5.1 Setup" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes" InstallCommand="/q" SourceFile="D:\NDP451-KB2858728-x86-x64-AllOS-ENU.exe"/>
  <ExePackage Id="SQLCompact" Name="Microsoft SQL Compact 4.0 Setup" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes" InstallCommand="/q" SourceFile="D:\SSCERuntime_x86-ENU.exe"/>

  <MsiPackage Id="CRRuntime" Name="Crystal Report Runtime" Cache="no" Compressed="yes" Permanent="yes" SourceFile="D:\CRRuntime_32bit_13_0_13.msi" Vital="yes" />
  </Chain>
</Bundle>

Whenever i try to Build the Bootstrapper Project, I am getting error as exception of type 'System.OutOfMemoryException' was thrown and in file light.exe and the build fails.

I have a Core i3 processor and 4GB of RAM and while building the project, VS using almost 2GB of RAM and system goes partially unresponsive until I close the Visual Studio. Stopping the Build process doesn't release acquired memory.

Can anyone help me out ?

Upvotes: 4

Views: 1274

Answers (2)

Pace
Pace

Reputation: 43817

Your IconSourceFile is a png and should be an ico. This causes light.exe to throw System.OutOfMemoryException

Upvotes: 0

Hawkeye
Hawkeye

Reputation: 638

Unfortunately, I think this just comes down to the computer not being able to handle everything Visual Studio is trying to do. I ran into the same issue, which only went away when getting a new computer with more RAM.

Explanation

The reason it's quitting before the RAM is used up is an individual processes wants to allocate a specific amount of memory when it starts (when you're doing a build, a lot of processes start up, all asking for memory) but when there is not enough memory to allocate for a request, the system throws an exception.

And you may not see the memory completely used up at the time of the error message because the request was larger than what you had available, so it didn't allocate the memory, thus it is still available.

(You can take a look at the MSDN to see how the computer allocates memory.)

And "stopping the build" after an exception doesn't necessary "stop the build." A number of the process that started when you started the build are probably still running.

As a rule-of-thumb, whenever you get an out of memory exception, you need to close and reopen the application. It will not behave properly until you do.

It's also worth noting, if you're running 32-bit, only 3GB of RAM can be accessed.

Here's a picture of my old 32-bit 4GB computer with a project open in Visual Studio. Notice Available memory is only 827 MB.

enter image description here

Now imagine all the processes that are going to try to grab more memory when I build the project.

For me going from 4GB of RAM with a 32-bit processor to 16GB of RAM with a 64-bit processor completely resolved all my performance and memory issues.

Upvotes: 1

Related Questions