question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"fatal error C1002: compiler is out of heap space" using asyncua

See original GitHub issue

Hi,

I develop a soft with these config and dependencies:

  • python: 3.10.0 64 bits
  • Windows 10 64 bits
  • 16 GB RAM
  • pyside6: 6.3.1
  • asyncua: 0.9.94 link
  • ordered-set: 4.1.0

The header of the entry point file is:

# nuitka-project: --standalone
# nuitka-project: --low-memory
# nuitka-project: --enable-plugin=pyside6
# nuitka-project: --include-qt-plugins=all
# nuitka-project: --windows-icon-from-ico=E:\Repositorios\produccion\app\resources\app.ico
# nuitka-project: --windows-disable-console
# nuitka-project: --windows-uac-admin
# nuitka-project: --windows-product-name=PRODUCCION
# nuitka-project: --windows-product-version=0.0.0.1

The nuitka log:

Nuitka-Options:INFO: Used command line options: --standalone --low-memory --enable-plugin=pyside6 --include-qt-plugins=all ..\app\main.py
Nuitka:INFO: Starting Python compilation with Nuitka '0.9.6' on Python '3.10' commercial grade 'not installed'.
Nuitka-Plugins:INFO: pyside6: Injecting pre-module load code for module 'PySide6': 
Nuitka-Plugins:INFO: pyside6: Adding binary folder to runtime 'PATH' environment variable for proper Qt loading.
Nuitka-Plugins:INFO: pyside6: Injecting post-module load code for module 'PySide6.QtCore':
Nuitka-Plugins:INFO: pyside6: Setting Qt library path to distribution folder. We need to avoid loading target
Nuitka-Plugins:INFO: pyside6: system Qt plugins, which may be from another Qt version. 
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'cryptography' added '_cffi_backend'.
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'pkg_resources.extern' added 'pkg_resources._vendor.packaging,pkg_resources._vendor.pyparsing,pkg_resources._vendor.appdirs'. 
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'pkg_resources._vendor.packaging' added 'pkg_resources._vendor.packaging.version,pkg_resources._vendor.packaging.specifiers,pkg_resources._vendor.packaging.requirements'.                                                                                                                       PASS 1: 29.7%|███████▍                 | 173/583, asyncua.server.standard_address_space.standard_address_space_servic
PASS 1: 29.8%|███████▍                 | 174/583, asyncua.server.standard_address_space.standard_address_space_servic
PASS 1: 29.8%|███████▍                 | 174/583, asyncua.server.standard_address_space
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'PySide6.QtSql' added 'PySide6.QtCore,PySide6.QtWidgets,shiboken6,shiboken6.Shiboken'.
Nuitka-Plugins:INFO: pyside6: Implicit dependencies of module 'PySide6.QtSql' added PySide6.QtCore,PySide6.QtGui,PySide6.QtWidgets'. 
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'shiboken6' added 'argparse'. 
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'PySide6.QtCore' added 'os,shiboken6,shiboken6.Shiboken'.                                                                                                                Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'PySide6.QtGui' added 'PySide6.QtCore,os,shiboken6,shiboken6.Shiboken'. 
Nuitka-Plugins:INFO: pyside6: Implicit dependencies of module 'PySide6.QtGui' added 'PySide6.QtCore'. 
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'PySide6.QtWidgets' added 'PySide6.QtCore,PySide6.QtGui,shiboken6,shiboken6.Shiboken'.
Nuitka-Plugins:INFO: pyside6: Implicit dependencies of module 'PySide6.QtWidgets' added 'PySide6.QtGui'.
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'PySide6.QtNetwork' added 'PySide6.QtCore,shiboken6,shiboken6.Shiboken'. 
Nuitka-Plugins:INFO: pyside6: Implicit dependencies of module 'PySide6.QtNetwork' added 'PySide6.QtCore'.
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'urllib.request' added 'http.client,http.cookiejar'.                                                                                                                     Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'socket' added '_socket'.
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'shelve' added 'dbm.dumb'. 
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'pathlib' added 'ntpath,posixpath'. 
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'importlib.metadata' added 'email'. 
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'ctypes' added '_ctypes'.
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'concurrent.futures.process' added 'multiprocessing,multiprocessing.connection'.
Nuitka-Plugins:INFO: multiprocessing: Injecting pre-module load code for module 'multiprocessing': 
Nuitka-Plugins:INFO: multiprocessing: Monkey patching "multiprocessing" load environment.
Nuitka-Plugins:INFO: multiprocessing: Injecting post-module load code for module 'multiprocessing':
Nuitka-Plugins:INFO: multiprocessing: Monkey patching "multiprocessing" for compiled methods.
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module '_asyncio' added 'asyncio'.
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'quopri' added 'py_compile'.
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'encodings' added 'encodings.idna,encodings.base64_codec,encodings.hex_codec,encodings.rot_13'.                                                                          Nuitka-Plugins:INFO: pyside6: Including Qt plugins 'qml' below 'PySide6\qml'.
Nuitka:INFO: Completed Python level compilation and optimization.
Nuitka:INFO: Generating source code for C backend compiler.
Nuitka:INFO: Running data composer tool for optimal constant value handling.
Nuitka:INFO: Running C compilation via Scons.
Nuitka-Scons:INFO: Backend C compiler: cl (cl 14.1).
Nuitka-Scons:INFO: Backend linking program with 177 files (no progress information available).

And the returned error is

Nuitka-Scons:INFO: Running 'link @C:\\Users\\Santiago\\AppData\\Local\\Temp\\tmpfjz8jfej.lnk' took 3836.83 seconds 
Unexpected output from this command: link @C:\Users\Santiago\AppData\Local\Temp\tmpfjz8jfej.lnk 
Generating code e:\repositorios\produccion\deploy\main.build
\module.asyncua.server.standard_address_space.standard_address_space_services.cpp(95) : fatal error C1002: compiler is out of heap space in pass 2 LINK : fatal error LNK1257: code generation failedscons: *** [E:\REPOSI~1\PRODUC~1\deploy\MAIN~1.DIS\main.exe] Error 1257

I tried with --low-memory and --lto=yes/no flags. Same result in all cases. Each run takes 1 hr approx.

I think the problem is related to asyncua lib which depends on asyncio, but I don’t idea how workaround this issue.

Any suggestions are very well welcome!

Thanks in advance

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, Aug 1, 2022

Seems pretty consistent which module it is, one with no less than 200k lines of code.

I disabled to compile these via C, and Nuitka will include the large 3 offenders as bytecode, avoiding the issue. Please try this and let me know if there are others:

https://nuitka.net/doc/factory.html

1reaction
kayhayencommented, Jul 30, 2022

There are more modules like this in asyncua, where for me Python compile time is already unacceptable, I assume some of them are pathological as C and might have to be disabled. I will check out if they can be enhanced.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cythonize ends with 'fatal error C1002: compiler is out of heap ...
Is there any way to increase the heap space when trying to "cythonize -i script.py" ? Cython documentation is really not clear on...
Read more >
VS2019 16.2 "fatal error C1002: compiler is out of heap space ...
VS2019 16.2 "fatal error C1002: compiler is out of heap space in pass 2" compiling SSE heavy file with optimizations for x64.
Read more >
Fatal Error C1002 | Microsoft Learn
The compiler ran out of dynamic memory space during its second pass, probably due to a program with too many symbols or complex...
Read more >
fatal error C1002: compiler is out of heap space in pass 2
build environment: vs2015 x64, paraview 5.7.0, windows 10 I got compile error: fatal error C1002: compiler is out of heap space in pass...
Read more >
[Solved] Compiler is out of heap space - FreeCAD Forum
Just downloaded the src from github and tried to compile it with VS2019 ... fatal error C1060: compiler is out of heap space...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found