Skip to content

ui: grid.hpp, mount.hpp and table_state.hpp cost 1.9-2.6 GB each to parse under the sanitizer flags, which sets the floor of every UI translation unit #1175

Backlog

Description

@Yaraslaut

What

Including one of the UI headers on its own, with nothing else in the translation unit, costs this much peak compile memory under CI's clang-asan flags (-O0 -gline-tables-only -fsanitize=address,undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer, the project's other flags from compile_commands.json, clang 23):

ui/grid.hpp: rc=0 2.61 GB
ui/mount.hpp: rc=0 2.27 GB
ui/table_state.hpp: rc=0 1.91 GB
ui/interpreter.hpp: rc=0 0.67 GB
core/bridge.hpp: rc=0 0.65 GB

include/morph/ui/grid.hpp is 5,399 lines. A source file or test that touches table or grid types therefore starts at about 3.0-3.4 GB before its own code. That limits how far splitting a file can go. When src/ui/interpreter.cpp and tests/test_ui_table_model.cpp were split into 13 and 14 files, the heaviest new files still peaked at 3.64 GB (interpreter_forms.cpp) and 3.78 GB (test_ui_table_model_cell_walk.cpp).

Hosted Linux runners have 16 GB and build with --parallel $(nproc) (4), so four such files compiling at once use about 15 GB. When they ran out of memory, the runner died with exit 143 or "lost communication".

Verification status

  • Measured on 5d3f4f911 (branch feat/table-pending-cells) on a local workstation with clang 23. Each header was included alone in an empty .cpp and compiled with the interpreter.cpp compile command. Peak RSS was read from getrusage(RUSAGE_CHILDREN).
  • Not measured: GCC peaks, clang 22 (CI's version), or which parts of grid.hpp cost the most (templates instantiated in the header, inline function bodies, or transitive includes).

What would close it

Each of these headers costs no more than about 1 GB to parse alone under the same flags, or a measurement shows the cost is unavoidable at that size. Possible ways in: split grid.hpp by concern, move inline bodies out of line into src/ui, and cut transitive includes from the table headers.

Activity

  1. added
    enhancement
    on Nov 27, 2026
  2. Yaraslaut commented on Nov 27, 2026

    @Yaraslaut
    MemberAuthor

    Correction: this weight comes from the branch, not from master. Measured the same way (each header included alone, CI's clang-asan flags, clang 23):

    ui/grid.hpp branch: rc=0 2.61 GB
    ui/grid.hpp master: rc=1 0.07 GB        <- header does not exist on master (dbc812a22)
    ui/mount.hpp branch: rc=0 2.27 GB
    ui/mount.hpp master: rc=0 0.80 GB
    ui/table_state.hpp branch: rc=0 1.91 GB
    ui/table_state.hpp master: rc=1 0.07 GB <- does not exist on master
    

    feat/table-pending-cells (PR #1128) adds about 25k lines of fully inline UI headers, none of which use MORPH_API, and mount.hpp now includes table_rows.hpp (4,820 lines). This belongs to that change, so it is being fixed there: non-template bodies move out of line into src/ui and the headers' includes are trimmed. This issue closes when #1128 lands with each of these headers at about 1 GB or less.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions