Skip to content

fix: Add clearArea handler and Lua binding (Map Change Clear Cache) - #785

Open
jprzimba wants to merge 2 commits into
mainfrom
fix-change-map
Open

fix: Add clearArea handler and Lua binding (Map Change Clear Cache)#785
jprzimba wants to merge 2 commits into
mainfrom
fix-change-map

Conversation

@jprzimba

@jprzimba jprzimba commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

This is a possible solution for map switching on the server, especially on the Soul War map where switching happens frequently.
It was discovered that ebb and flow is a major memory leak.
With each loadMap, setBasicTile only overwrites tiles that exist in the new OTBM. Tiles that were in the previous map but are not in the new one remain in the Floor cache (shared_ptr), accumulating. After many swaps, thousands of orphaned shared_ptr pointing to old BasicTile objects are retained.

  • Implement Map::clearArea to clear tiles (and tile cache) in a rectangular XYZ region and forward it via Game::clearArea.
  • Expose the functionality to scripts as Game.clearArea Lua method (dispatched on the game thread).
  • Also fix a typo in soul_war_mechanics.lua referencing SoulWarQuest.ebbAndFlow.mapsPath.
  • Changes touch map, game and Lua binding headers/implementations.

NOTE: This isn't 100% yet, but we're running tests to see how it behaves during the time the server is online. This PR is subject to change.

@Sh3Ns

Sh3Ns commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Testei o ebb and flow do Soul War com múltiplas trocas de mapa e tudo funcionando perfeitamente. Nenhum problema identificado até o momento. ✅

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 45 days with no activity.

@github-actions github-actions Bot added the Stale label Jul 22, 2026
@github-actions github-actions Bot removed the Stale label Aug 5, 2026
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.

2 participants