Click here to Skip to main content
15,885,365 members
Articles / Memory
Tip/Trick

Out of Memory in Visual Studio

Rate me:
Please Sign up or sign in to vote.
4.42/5 (8 votes)
27 Aug 2012CPOL2 min read 45.6K   7   5
The "ResolveManifestFiles" task failed unexpectedly. System.OutOfMemoryException: Insufficient memory to continue the execution of the program.

Introduction

As part of assignment, I was working on a project, which is having 137 projects Windows Form in a solution. Whenever I was building my solution, I was getting Out-Of-Memory error and due to this my Visual Studio use to get crash. Then the only solution left with me was to restart my Visual Studio L. Earlier I as facing this issue once a while, but from last week, it is occurring frequently. Hope you can imagine, how painful it is restart the Visual Studio every now-and-then, especially when your solution contains such a huge number of projects. My error was something like this: “The "ResolveManifestFiles" task failed unexpectedly. System.OutOfMemoryException: Insufficient memory to continue the execution of the program.”

The only thing, which was coming into my mind, was that it is due to Visual Studio’s memory limits. I also tried to minimize Visual Studio, but no luckL.

After consulting with few people, I got an idea to breakup my solution into multiple solutions. But again, it was not the best solution for me because my project was already on the last stage (about to over) and it was not the correct time to take this much big risk. So, I dropped this suggestion also.

After hitting my head for 4-5 days, I reached to some conclusion. One of the reasons was Heap fragmentation, due to which, my Virtual Memory was keep raising and ultimately it was affecting my GC. But this reason was also not 100% correct. Because Virtual Memory will rise, only when I’ll run my application. But in my case, I was getting error during build itself. So, again no luck L

While doing analysis on the same, I thought, let’s open manifest file and check once. And luckily I got the clue. On opening manifest file, I found that there are lot of hash values which are nothing but my image files. In my project I was using approx 150 image files. According to my project requirement, we were not supposed to deploy those image files. Then what those files were doing there, why they are part of my manifest?  Now a very BIG question was, how those image files became part of my manifest?

This happened because Visual Studio, by default sets image’s ‘Build Action’ property to ‘Content’. As soon as I changed this property to ‘None’, my error goes off. This one small property worked like a charm for me J

By setting ‘Build Action’ property to ‘None’, I was able to reduce the size of manifest file to approx 0.9GB.

I shared this as a tip, so that you need not to spend 5-6 days, to analyze the issue J

Points of Interest

Whenever you get out of memory error in visual studio, one possible reason can be due to huge manifest file. So, just try to play around it and you will get some clue Smile | :)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions

 
QuestionHow to apply it in Visual Studio 2005? Pin
Budisanto Tanoto15-Jun-16 18:20
Budisanto Tanoto15-Jun-16 18:20 
QuestionProblem generating manifest. Insufficient memory to continue the execution of the program Pin
Rakesh Meel18-Jun-15 21:00
professionalRakesh Meel18-Jun-15 21:00 
QuestionOut of Memory in Visual Basic 6.0 Pin
Member 1130203810-Dec-14 14:41
Member 1130203810-Dec-14 14:41 
QuestionWhere is the Build Action Setting? Pin
Joe Sweeney24-Apr-13 9:50
Joe Sweeney24-Apr-13 9:50 
I am also having problems with VS2012 using a lot of memory. Your article does not mention where to find the Build Action setting.

Thanks.
GeneralMy vote of 5 Pin
Christian Amado27-Aug-12 9:17
professionalChristian Amado27-Aug-12 9:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.