Xap packaging failed. Exception of Type 'System. outofmemoryexception' was thrown

Source: Internet
Author: User
ArticleDirectory
    • Not enough storage ...?
    • Its a software problem.
    • The hack... err, solution.
    • Look at all that memory!

Original address

Visual Studio can be a tremendous resource hog, especially if you
Have a large solution and you're using a productivity add-in or two.

On my current project we're running vs 2008, we're 've got just under 20 projects in the solution, and several of us are using the resharper 4.0 EAP nightly builds
To enhance our Dev-fu. And you know what... We're re restarting vs
Least a half dozen times a day to work around und a nasty exception we
Regularly encounter while trying to compile:

Not enough storage is available to complete this operation.

Not enough storage ...?

Yep-storage. But you shoshould readStorageTo meanMemory... Ram that is.

After
Running for a while the Visual Studio process (found under devenv.exe
In process Explorer) maxes out its available memory and the above
Exception is thrown. The only way to reclaim the memory and successfully
Compile the solution is to restart the process.Bummer!

Maybe we shoshould just upgrade our hardware, right?

I
Mean, with cost of processor cycles and ram falling as fast as gas
Prices are rising, why not just spend a few bucks and make sure we're
All running multi-core boxes with 4 + gigabytes of memory and storage
Space to burn. Well guess what... we are.

All of the developers
Are Running nice beefy machines with lots of RAM, super-fast processors,
And we even have nice 21 "wide screen DVI monitors. So this ain't no hardware problem.

Its a software problem.

I
Will admit, we are running a mix of 32-bit operating systems-mostly
Vista with a handful of XP machines mixed in for the Devs that roll that
Way. And Jeff Atwood has covered the missing Ram problem before, but even switching to a 64-bit OS wouldn't solve our problem. At least not entirely.

The
Problem is with Visual Studio. Being a 32-bit application its limited
To just 2 GB of virtual memory, even if its running in a 64-bit OS.
Least, its limited to 2 GB by default... but we canHack aroundChange that.

The hack... err, solution.

The first thing to do is tell the OS to increase the amount user-mode memory from 2 GB to 3 GB.If you're running a 64-bit you can skip this step.

    • ForWindows XP: BackupBoot. iniFile and then put the/3 GB switch in yourBoot. ini. (More information on the/3 GB option)
    • ForVista: Run the following from the Visual Studio command prompt (Brad rutkoski has the full scoop ):
      1:Bcdedit/set increaseuserva 3072.

Note:

The boot. INI is a hidden file at the root of C:. You have to go
Explorer/tools/options and set view to include system and hidden files.
Now you will be able to see it.

You can also go to run and type "Edit c: \ Boot. ini ".

Then we have make Visual Studio large address aware.

    1. Be sure to backupDevenv.exe
    2. Using the Visual Studio command prompt, navigateC: \ Program Files \ Microsoft Visual Studio 9 \ common7 \ ide \
    3. Execute the following command:
      1:Editbin/largeaddressaware devenv.exe

Finally we'll use the old Microsoft-fix-all-reboot the machine.Bounce that box!

Look at all that memory!

At this point Visual Studio shocould be allowed to consume up to 3 GB of memory before throwing that uuglyOut of Memory exception.

Just to show you I'm not lying, I grabbed a screen shot of my process ExplorerDevenv.exeProcess chewing up greater than 2.5 GB of memory.Sweet!

Note:Even with our large solution and running the early,
And memory-hungry, resharper bits, Visual Studio typically stays around
Or just above the 2 GB mark. However it can spike up to 2.5 + GB while
Compiling, as show in this screen shot.

Notes: we also need to avoid binding errors in runtime.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.