Skip to content

fix(flatheightmap): Fix flat terrain tiles leaking on device reset - #3479

Merged
xezon merged 1 commit into
TheSuperHackers:mainfrom
tintinhamans:arctic/fix/flat-terrain-reset-leak
Oct 13, 2026
Merged

xezon merged 1 commit into
TheSuperHackers:mainfrom
tintinhamans:arctic/fix/flat-terrain-reset-leak

Conversation

@tintinhamans

Copy link
Copy Markdown

FlatHeightMapRenderObjClass::ReleaseResources never frees m_tiles. ReAcquireResources allocates a new array over it, so every device reset leaks the old tiles with their vertex and index buffers, textures and map reference.

ReleaseResources now calls releaseTiles first, same as initHeightData does when the tile count changes.

Only reachable with TerrainLOD = AUTOMATIC, retail data uses DISABLE. Relevant for #3237.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 35a1b8fe-2292-41df-b5b7-60f7d9a6a595
📥 Commits

Reviewing files that changed from the base of the PR and between fa486c0 and 6539b7a.

📒 Files selected for processing (1)
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Walkthrough

FlatHeightMapRenderObjClass::ReleaseResources now releases the terrain tile array before calling the base resource-release method.

Changes

Terrain resource release

Layer / File(s) Summary
Release terrain tiles
Core/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp
ReleaseResources calls releaseTiles() before the base resource-release method.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Suggested reviewers: cryotherenegade

Merge Risk: ⚪ Minimal · up to 6539b

Resource release now frees terrain tiles before cleanup, and reacquisition can rebuild them. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly identifies the fix for leaking flat terrain tiles during device reset. It is concise and directly matches the primary change.
Description check Passed The description explains the tile leak, the device-reset scenario, the code change, and its scope. It is directly related to the changeset.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the added cleanup fits the existing terrain rebuild path.

Summary

Adds releaseTiles() before base cleanup in FlatHeightMapRenderObjClass::ReleaseResources().

  • Flat terrain tiles are cleared before reset rebuilds them.

Reviews (2) · Last reviewed commit: "bugfix(w3d): Fix flat terrain tiles leak..." · Reviewed by Greptile

@Mauller Mauller left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks clear

Comment thread Core/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp Outdated
@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour Memory Is memory related Fix Is fixing something, but is not user facing labels Oct 12, 2026
@tintinhamans
tintinhamans force-pushed the arctic/fix/flat-terrain-reset-leak branch from fa486c0 to 6539b7a Compare October 12, 2026 20:03
@xezon xezon changed the title bugfix(w3d): Fix flat terrain tiles leaking on device reset fix(flatheightmap): Fix flat terrain tiles leaking on device reset Oct 13, 2026
@xezon
xezon merged commit 4f71d37 into TheSuperHackers:main Oct 13, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fix Is fixing something, but is not user facing Gen Relates to Generals Memory Is memory related Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants