none
Problem with heap space when compiler is called by other software. RRS feed

  • Question

  • Hello,

    I am calling the visual studio compiler through ANSYS Fluent and when I try to compile I get the error:

    The compiler is out of heap space

    Is there a compiler flag I can use to increase the available heap space when compiling?  The file I am compiling is massive because it has 2000 double vectors with 1000 elements each, but I have 128GB of RAM on this system so I think it can handle it.  I have seen the linker flag - /HEAP:1000000 but this does not work as a compiler flag.  I do not see where I can pass flags to the linker in the ANSYS Fluent interface.

    Thanks


    • Edited by matt_funker Friday, November 1, 2019 9:22 PM
    Friday, November 1, 2019 9:19 PM

All replies

  • Hi matt_funker,

    Welcome to the MSDN forum.

    As your description, you can try to use the /Zm parameter such /Zm 10 to decrease the amount of memory the compiler USES to construct precompiled headers.

    In addition, 

    ##If you are compiling on a 64-bit platform, use the 64-bit compiler toolset. For information, see How to: Enable a 64-Bit Visual C++ Toolset on the Command Line.

    ##On 32-bit Windows, try using the /3GB boot.ini switch.

    ##Increase the size of the Windows swap-file.

    ##Close other running programs.

    ##Eliminate unnecessary include files.

    ##Eliminate unnecessary global variables, for example, by allocating memory dynamically instead of declaring a large array.

    ##Eliminate unused declarations.

    ##Split the current file into smaller files.

    >>You can refer to this official document to find more information.

    BTW, you can also try to use /maxcpucount to enhance build efficiency.

    Any feedback will be expected.

    Best Regards,

    Perry


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Monday, November 4, 2019 8:53 AM
  • Hello Perry,

    Thank you for your reply and advice.  I do have a question.  It seems the only access I have to the compiler is through the make file where ANSYS has included a line for compiler flags.  I will try the Zm flag, but is there a way I can tell the compiler to compile in 64 bit mode from a flag?  I don't actually see the command line when compiling form inside ANSYS.  ANSYS calls VS through a make file.

    Thanks

    Monday, November 4, 2019 8:09 PM
  • Hi matt_funker,

    Thanks for your feedback.

    According to your description, l think you want to use x64 Native Tools Command Prompt which sets the environment to use 64-bit, x64-native tools to build 64-bit, x64-native code to compile your project so that you can call the x64 compiler to build your project.

    Also, you can refer to this article.

    Best Regards,

    Perry


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Tuesday, November 5, 2019 3:31 AM
  • Thanks again, Perry.

    I tried the /Zm20 and it still ran out of heap space so I think that will not fix the problem.  I understand the need to switch to the x64 Native Tools Command Prompt, but I do not understand how to do that. 

    I notice in the file that ANSYS calls, there is a line:

    #      Make sure the VC compiler is set up for command line mode, use
    #      the file Vcvars32.bat from Visual Studio to assist this.

    So there must be a way to use the Vcvars64.bat but how exactly do I "Make sure the VC compiler is set up for command line mode"? I don't know what is done to make sure that it is set up for command line mode, as it must have been done automatically for the x86 when it installed.  I need help with this part.  Like step 1, step 2, etc.

    Later in the file I see these lines:

    SRC = ..\..\src^\ CC = cl # compile flags # /c for compile only, /Za for ansi c and __STDC__ is set CFLAGS = /c /Za /DUDF_EXPORTING /DUDF_NT /DWIN64 /EHa /wd4224 /bigobj /Zm20

    The lines that do the compiling look like:

    $(UDF_OBJECT): $(UDFDATA)
    	$(CC) $(CFLAGS) $(INCLUDES)  $**

    Please advise what to do to get this to call the 64bit one.

    Thanks!


    • Edited by matt_funker Tuesday, November 5, 2019 5:09 PM typo
    Tuesday, November 5, 2019 5:08 PM
  • Hi matt_funker,

    I don't know if it's helpful to you -----you can locate into the parameter CC and then replace its path to 

    -----%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"

    If it does not work, you suggest you can redirect your issue to ANSYS Fluent forum for better support.

    Thanks for your understanding.

    Best Regards,

    Perry


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Wednesday, November 6, 2019 11:51 AM