From 79cf04942ef8611f82e0a930a843f8e9d3bf1fc1 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 17 May 2025 09:48:33 -0400 Subject: [PATCH] Free map terrain and bg models once we load them Unlike the Gear Editor, we don't need these later (for export and such - yet!) and can be safely removed. This significantly reduces the memory pressure from loading maps, but it's not all sunshine and rainbows yet. --- apps/mapeditor/src/mapview.cpp | 10 ++++++++++ extern/libphysis | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/mapeditor/src/mapview.cpp b/apps/mapeditor/src/mapview.cpp index b549052..2326be8 100644 --- a/apps/mapeditor/src/mapview.cpp +++ b/apps/mapeditor/src/mapview.cpp @@ -80,7 +80,12 @@ MapView::MapView(GameData *data, FileCache &cache, AppState *appState, QWidget * QString::fromStdString(assetPath), materials, 0); + + // We don't need this, and it will just take up memory + physis_mdl_free(&plateMdl); } + + physis_free_file(&plateMdlFile); } } break; } @@ -119,6 +124,11 @@ void MapView::addTerrain(QString basePath, physis_Terrain terrain) QStringLiteral("terapart%1").arg(i), materials, 0); + + // We don't need this, and it will just take up memory + physis_mdl_free(&plateMdl); + + physis_free_file(&plateMdlFile); } } } diff --git a/extern/libphysis b/extern/libphysis index 5a1cf87..4a1332b 160000 --- a/extern/libphysis +++ b/extern/libphysis @@ -1 +1 @@ -Subproject commit 5a1cf87fb9a04ed8ccfbd635564eaf26654fc0a5 +Subproject commit 4a1332b6199c5146730a31ceab9f3ae2c7ecc7f1