Skip to content

Trim Nuitka build to fit MSVC's per-file heap cap#7

Merged
JE-Chen merged 1 commit into
mainfrom
dev
May 17, 2026
Merged

Trim Nuitka build to fit MSVC's per-file heap cap#7
JE-Chen merged 1 commit into
mainfrom
dev

Conversation

@JE-Chen
Copy link
Copy Markdown
Member

@JE-Chen JE-Chen commented May 17, 2026

Summary

Single-commit fix (06c0e80) for the Windows Nuitka build's C1002: compiler is out of heap space in pass 2 errors that bombed PR #6's release.

What broke

Three generated C files exceeded MSVC's per-file heap cap:

File Lines Cause
module.pymupdf.mupdf.c 2,206,786 pymupdf's Cython binding for MuPDF — unfixable by tuning MSVC
module.typing_extensions.c 94,793 end-of-file OOM, fixable by lowering optimization
module.uvicorn._types.c 4,583 small file, OOM caused by parallel-job heap contention

Three coupled fixes

  1. Drop pymupdf from the build venv. Replace pip install -e ".[intelligence,mcp,gui]" with pip install -e ".[mcp,gui]" + pip install pypdf anthropic. The bundle uses pypdf alone for PDF text extraction. PyPI users still get pymupdf via pip install autopapertoppt[intelligence]. Belt-and-suspenders: --nofollow-import-to=pymupdf.

  2. --nofollow-import-to=uvicorn,fastapi,starlette,websockets,streamlit,tornado. These get pulled in transitively by mcp/web extras but the bundle's autopapertoppt-mcp uses stdio transport, never SSE/HTTP — so we never need them at runtime.

  3. --lto=no --jobs=2. Disabling link-time optimization drops MSVC's peak heap pressure (LTO holds the full module graph in memory). --jobs=2 caps parallel compilation at 2 workers instead of the runner's default of 4 cores, halving concurrent heap usage.

Test plan

  • CI matrix passes
  • On merge: Nuitka build completes within the 90 min cap (likely 60-75 min cold with --jobs=2 instead of 50-70)
  • autopapertoppt-windows-x86_64.zip lands on the release, publish-release unmarks the draft, version shows in sidebar
  • The unzipped .exe runs --help and gui correctly
  • The .exe shows the icon embedded by --windows-icon-from-ico

The Windows Nuitka build hit C1002 'compiler is out of heap space
in pass 2' on three files:

  module.pymupdf.mupdf.c     2,206,786 lines  ← unfixable in MSVC
  module.typing_extensions.c    94,793 lines  ← end-of-file OOM
  module.uvicorn._types.c        4,583 lines  ← parallel-job OOM

Three coupled changes:

1. Drop pymupdf from the BUILD venv. Replace 'pip install -e
   .[intelligence,mcp,gui]' with 'pip install -e .[mcp,gui]' +
   'pip install pypdf anthropic'. pypdf alone covers the bundle's
   PDF-text path; PyPI users who 'pip install autopapertoppt
   [intelligence]' still get pymupdf the regular way.

2. Add --nofollow-import-to for pymupdf + uvicorn + fastapi +
   starlette + websockets + streamlit + tornado. Belt-and-suspenders
   with the install change for pymupdf; the rest get pulled in
   transitively by mcp/web extras and we never use them at runtime
   from inside the .exe (autopapertoppt-mcp uses stdio, not SSE/
   HTTP transports). Excluding them avoids both compile time and
   bundle size.

3. --lto=no + --jobs=2. Disabling link-time optimization drops
   MSVC's peak heap pressure (LTO holds the full module graph in
   memory at link time). --jobs=2 caps parallel compilation at 2
   workers instead of the runner's default 4, halving concurrent
   heap usage during the per-module compile step.

Together these should let typing_extensions.c compile within the
MSVC per-process heap limit and skip the pymupdf bomb entirely.
Build time may go up slightly from --jobs=2 vs. default, but a
build that completes beats one that doesn't.
@JE-Chen JE-Chen merged commit e326767 into main May 17, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant