none
MSB0001:Internal MSBuild Error:Exception of type 'System.OutOfMemoryException' was thown RRS feed

  • Question

  • When I want to add a reference from the testproject to the project (it's a 4.1 MB dll) that needs to be tested with unit tests, the error as described in the title is displayed (see also picture). I develop in VS2010. Is the dll to big to make a reference to, is there a limit? I tried several different project properties, but nothing seems to work.

    Environment: Windows7 Professional, 32 bits

    Installed memory: 4GB

    Project defaults:

    Configuration Type: Dynamic Library

    Use Of MFC: Use MFC in a Shared DLL

    Use of ATL: Not Using ATL

    Character Set: Use Multi-Byte Character Set

    Common Language Runtime Support: No Common Language Runtime Support

    Whole Program Optimization: No Whole Program Optimization

     

     

     

    Monday, January 16, 2012 1:09 PM

Answers

  • What is your project file content, could please show the MSBuild project file here. I think it is a MSBuild related question, not for VSTO. http://social.msdn.microsoft.com/Forums/en/msbuild/threads/

    If you are developing a large project, and it may use much memory during building, I suggest you move to 64-bit system with more memory. Since the 32-bit system only can provide less than 2GB memory to user application in default. 

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by ProgrammerLeon Wednesday, February 15, 2012 12:36 PM
    Wednesday, January 18, 2012 3:35 AM
    Moderator
  • First of all, 32bit applications has a 2GB user-mode address space limitation, the chance of OOM exception will be higher than 64bit application, Visual Studio itself if 32bit.

    Second, Visual Studio will allocate memory for its add-on, meanwhile, an add-on may create separate heap itself, if we install too many add-on, the memory usage might be high.

    Third, if your solution contains two many projects, it will also consume more momery.

    To avoid the memory usage issue, we may:

    1.        Use command line instead of VS IDE

    MSBuild Command Line Reference à  http://msdn.microsoft.com/en-us/library/ms164311.aspx

    1.        Disable or uninstall Visual Studio add-on, or run VS under safe mode.

    Devenv.exe /safemode

    1.        Separate a huge Visual Studio solution to several small solutions.
    2.        Enable /3GB mode to enlarge user-mode address space.

    Available switch options for the Windows XP and the Windows Server 2003 Boot.ini files à http://support.microsoft.com/kb/833721

    1.        Switch to 64bit Windows, under WOW64 mode, user-mode address space for Visual Studio is about 4GB.

    Reference:

    System.OutOfMemoryException thrown while building a large C# solution using Visual Studio 2005 SP1 IDE.

    http://support.microsoft.com/kb/949755

    FIX: The Visual Studio 2005 IDE may crash when you compile a large Visual Basic 2005 project

    http://support.microsoft.com/kb/944840



    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Regards,
    Eric Yang
    Microsoft Online Community Support

    • Marked as answer by ProgrammerLeon Wednesday, February 15, 2012 12:22 PM
    Friday, February 10, 2012 7:10 AM

All replies

  • Hi ProgrammerLeon,

     

    Thanks for posting in the MSDN Forum.

     

    Would you please tell me whether you will use Visual Studio Tools of Office in your issue?

     

    Have a good day,

     

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, January 18, 2012 3:14 AM
    Moderator
  • What is your project file content, could please show the MSBuild project file here. I think it is a MSBuild related question, not for VSTO. http://social.msdn.microsoft.com/Forums/en/msbuild/threads/

    If you are developing a large project, and it may use much memory during building, I suggest you move to 64-bit system with more memory. Since the 32-bit system only can provide less than 2GB memory to user application in default. 

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by ProgrammerLeon Wednesday, February 15, 2012 12:36 PM
    Wednesday, January 18, 2012 3:35 AM
    Moderator
  • Hello MSDN Forum Assistant,

    Thanks for the reply, but can you explain you're answer, i'm not sure what you mean.

     

    Regards,

     

    ProgrammerLeon

     

    Wednesday, January 18, 2012 9:13 AM
  • Hello Bob,

     

    Thanks for the answer, but what project file content do you mean? The application i'm working on has many header and cpp files.

     

    Sincerely,

     

    ProgrammerLeon

    Wednesday, January 18, 2012 12:39 PM
  • Like the .csproj (C# project MSBuild file) .vbproj (VB.Net project MSBuild file) .vcxproj (VC++ project MSBuild file) etc files. They are the MSBuild file, and the MSBuild tool can identofy it, biuld it. We want to help you to check the file if your project setting contains the special value. Or the MSBuild cannot use more memory to help you to build this project.
    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, January 18, 2012 4:05 PM
    Moderator
  • Hi ProgrammerLeon,

    We have got your files, and we are checking it. Any update, we will share here.

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Thursday, January 19, 2012 9:05 AM
    Moderator
  • Hello Bob,

    How is the check going sofar? I'm still waiting.

    Sincerely,

    ProgrammerLeon

    Wednesday, January 25, 2012 11:27 AM
  • I have consulted it internal, but these days are the holiday in China. It may be delay.

    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, January 25, 2012 12:17 PM
    Moderator
  • First of all, 32bit applications has a 2GB user-mode address space limitation, the chance of OOM exception will be higher than 64bit application, Visual Studio itself if 32bit.

    Second, Visual Studio will allocate memory for its add-on, meanwhile, an add-on may create separate heap itself, if we install too many add-on, the memory usage might be high.

    Third, if your solution contains two many projects, it will also consume more momery.

    To avoid the memory usage issue, we may:

    1.        Use command line instead of VS IDE

    MSBuild Command Line Reference à  http://msdn.microsoft.com/en-us/library/ms164311.aspx

    1.        Disable or uninstall Visual Studio add-on, or run VS under safe mode.

    Devenv.exe /safemode

    1.        Separate a huge Visual Studio solution to several small solutions.
    2.        Enable /3GB mode to enlarge user-mode address space.

    Available switch options for the Windows XP and the Windows Server 2003 Boot.ini files à http://support.microsoft.com/kb/833721

    1.        Switch to 64bit Windows, under WOW64 mode, user-mode address space for Visual Studio is about 4GB.

    Reference:

    System.OutOfMemoryException thrown while building a large C# solution using Visual Studio 2005 SP1 IDE.

    http://support.microsoft.com/kb/949755

    FIX: The Visual Studio 2005 IDE may crash when you compile a large Visual Basic 2005 project

    http://support.microsoft.com/kb/944840



    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Regards,
    Eric Yang
    Microsoft Online Community Support

    • Marked as answer by ProgrammerLeon Wednesday, February 15, 2012 12:22 PM
    Friday, February 10, 2012 7:10 AM
  • While seperating a part of the solution i got the next error after building the project:

    LINK : fatal error LNK1248: image size (BDA58000)
    exceeds maximum allowable size (80000000)

    So i discovered that a large float array in the code was responsible for the error, so i reduced the size of the array. After that it was also possible to make a reference from the testproject to the project.dll. So i'm a little smarter now about unittesting, making references and memory errors.   


    Wednesday, February 15, 2012 12:34 PM