MSVC sends heavy template code with "fatal error C1060: compiler goes out of heap"

I am trying to compile some relatively heavy template code with MSVC (2010), and it ultimately exits with fatal error C1060: compiler is out of heap space.

All this is just one translation unit, and, in comparison, gcc processes it quite easily (inside a virtual machine with significantly fewer resources).

Any clues what to look for? Are there suitable compiler options?

+3
source share
5 answers

You might be able to come across this by explicitly adding the / Zm option to the C / C ++ options of your project. e.g. / Zm256

0
source

/Zm, . , , , .

0

C1060 , . , Foo :

template< typename T1, typename T2, typename T3 > struct Foo
{
  T1 t1;
  T2 t2;
  T3 t3;
};

Foo< int, char, bool > foo;

.

template< typename T_ARG > struct Foo
{
  typename T_ARG::T1 t1;
  typename T_ARG::T2 t2;
  typename T_ARG::T3 t3;
};

struct FooArgs
{
  typedef int  T1;
  typedef char T2;
  typedef bool T3;
};

Foo< FooArgs > foo;

, :

  • .
  • , .
  • . Foo < TypeList < int, TypeList < char, TypeList < bool, NullType → → .
0

, - , :

cl.exe, 2 32- Windows. Windows 4- , 2 2 . 1/3. Windows 7 Vista :

bcdedit/set IncreaseUserVa 3072

. MSVC 3 2.

, - C1060. Resource Monitor, cl.exe 2 . .

1 . 2/2, :

bcdedit/deletevalue IncreaseUserVa

0

( ), /Zm1000 ( ). , , / .., :

C1060: .

, - ( ). , 32 , 6,1 . x64, .

MSDN , /Zm800 . , ; /Zm2000 32- ( , /Zm - ).

I am using MSVC 6.0, but I hope this helps in 2010 as well.

0
source

Source: https://habr.com/ru/post/1783741/


All Articles