Skip to content

wc3: size destructable pool separately, fix null missile model crash - #573

Merged
corepunch merged 1 commit into
mainfrom
feature/map-pool-size-check-228147
Oct 3, 2026
Merged

corepunch merged 1 commit into
mainfrom
feature/map-pool-size-check-228147

Conversation

@corepunch

Copy link
Copy Markdown
Owner

Summary

Follow-up to #570, which sized every lifecycle pool to MAX_ENTITIES (16000 slots × 27 pools ≈ 52 MB static, all memset on reset).

Verification

  • Reproduced: with the old 2048 cap, Prologue01 dies with WC3 pool destructable exhausted (also HumanX01 and other TFT maps), so that was the issue.
  • Added G_PoolsReportPeaks (logged at shutdown) and ran all 97 campaign maps. Peak destructables: 4917 (NightElf04), 4864 (UndeadX01), 4412 (Orc04), 3852 (Prologue01). Every other pool peaks at ≤ 300.

Changes

  • Destructable pool: 8192 slots; all other pools: 2048. Static pool data 52 MB → 26 MB.
  • Save loader count bound uses the largest cap.
  • G_RegisterModel(NULL/"") returns 0. 34 TFT X-campaign maps segfaulted in SV_ModelIndex once past the pool limit (missile attack with no art).
  • Tests: >2047 destructable allocations, null/empty model names. Docs updated.

Validation

make test-wc3-engine: 46354 assertions passed. Campaign audit: 97/97 maps completed, 0 crashes, 0 pool exhaustion.

🤖 Generated with Claude Code

Prologue01 (3852 destructables) and many campaign maps exhausted the
2047-slot lifecycle pools. Measured peak usage on all 97 campaign maps:
destructable 4917, every other pool <= 300. Give destructables an 8192-slot
pool and keep 2048 for the rest instead of sizing all 27 pools to
MAX_ENTITIES (52 MB -> 26 MB static).

Log per-pool peaks at shutdown. Make G_RegisterModel return 0 for a null or
empty name: TFT X-campaign units with a missile weapon but no art crashed in
SV_ModelIndex. Raise the save-load pool count bound accordingly.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@corepunch
corepunch merged commit 4f105d5 into main Oct 3, 2026
5 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