Friday, November 7, 2008

Visual Studio System.OutOfMemory Exception

I first came across this error while working on 20+ files in Visual Studio 2005 (all checked out from Visual Source Safe 2005).



The Error:

The "ResolveManifestFiles" task failed unexpectedly.
System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.NativeMethods.GetAssemblyIdentifyFromFile


Solution:
1. Do you have enough memory on your system? In my case I had 2GB of memory which is more then enough.

2. Reboot Your machine. This sometimes resolves the issue.

3. Reset the Visual Studio setting, check out How to Reset Your Settings at:

4. Have you applied the latest service pack? If not, I suggest you to apply the service pack.

5. If you reboot the operating system to safe mode, do we have the same problem? This can help to isolate whether any other applications are interfering with Visual Studio. In addition to safe mode, you can also try “clean boot”.

6. If you create a new user account, do we have the problem? This can help to isolate user profile corruption related causes.

7. If you disable Add-ns (e.g. “Tools” “Add-in Manager”) and run “devenv.exe /safemode”, do you still have the problem? This can eliminate the possibility that third party Add-ins are causing problems.

8. If you create a new project, do we have the problem? Sometimes corrupted project settings can cause problems. These are project specific.

9. Break the large project into smaller ones.

10. Use the /3GB option, so the user mode code can use 3GB address space. With the added 1GB address space, the frequency of the problem can be greatly reduced or even fixed. However, option 1 is still strongly recommended.
Here is how:

I. Backup the boot.ini file. Then, put the /3GB switch in your boot.ini.

For more information on the /3GB option, please check the following article: Memory Support and Windows Operating Systems:

II. Make DEVENV large address aware:

a. Open up a VS 2005 command prompt
b. Change directory to the Microsoft Visual Studio 8\Common7\IDE directory.
c. Backup devenv.exe file.
d. Type and execute the following command line: editbin /LARGEADDRESSAWARE devenv.exe
Reboot Windows and check if the problem persists.
That should do it!
Pete Soheil
DigiOz Multimedia

No comments: