GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
statistics

Fix detailed memory stats for PCH

Resolves failures in PCH tests when detailed memory statistics are enabled.

This commit fixes an issue where GCC’s detailed memory statistics gathering (--enable-gather-detailed-mem-stats) caused tests involving Precompiled Headers (PCH) to fail. The problem occurred because the statistics infrastructure did not recognize GGC’d objects loaded after a PCH restore, leading to errors in mem_alloc_description::release_object_overhead. The fix ensures these unknown objects are ignored, preventing test failures.

In Details

With --enable-gather-detailed-mem-stats, PCH restore can lead to GGC'd objects existing in the memory pool that are not known to mem_alloc_description's hash map. release_object_overhead previously crashed when it encountered such an unknown PTR. This commit adds a check to ignore these unknown objects, resolving PR middle-end/28734.

For Context
PCH
Precompiled Header. A file containing precompiled source code and compiler state, used to speed up compilation of large projects by avoiding redundant parsing and analysis.
GGC
GNU Garbage Collector. GCC's internal memory management system for its own data structures.
mem_alloc_description
A data structure within GCC responsible for tracking memory allocations for statistics gathering.
Filed Under: bugfixstatisticsPCH