[Solved] cc1plus.exe: out of memory allocating bytes

When I used MinGW to compile a C++ project under Windows today, I encountered an error in cc1plus.exe:

  1. cc1plus . exe : out  of memory allocating  352885  bytes 

At the same time, it is observed that the memory usage is very exaggerated, and each cc1plus.exe process almost eats more than 1G of memory.

The solution given on Stackoverflow was to convert the UTF-16 encoded file in the project to UTF-8, but it did not work.

After Google again, I found that https://github.com/CoolProp/CoolProp/issues/608  gave the perfect solution:

I think you need to upgrade your MINGW. I just tried to build the static library with MINGW on my machine and I got the below output. I just installed the TDM-GCC installation 4.9.4

That is to say, just change the compiler from MinGW to the latest TDM-GCC.

The MinGW project itself has not been maintained for several years, and the GCC version stays at 4.8.1.

In fact, there is also a GNU porting project called Mingw64. The relationship between the three is:

MinGW is only 32 bits, http://www.mingw.org/

Mingw64 has 32-bit and 64-bit: i686-w64-mingw32 and x86_64-w64-mingw32

TDM-GCC seems to be a package of Mingw64, which installs both 32-bit and 64-bit by default.

In addition, JetBrains CLion 1.1.1 supports TDM-GCC, only need to be set in ToolChain:


Similar Posts: