diff --git a/core/src/mindustry/ctype/UnlockableContent.java b/core/src/mindustry/ctype/UnlockableContent.java index faf53c8363..43190baa9e 100644 --- a/core/src/mindustry/ctype/UnlockableContent.java +++ b/core/src/mindustry/ctype/UnlockableContent.java @@ -115,6 +115,7 @@ public abstract class UnlockableContent extends MappableContent{ var result = Pixmaps.outline(base, outlineColor, outlineRadius); Drawf.checkBleed(result); packer.add(page, regName, result); + result.dispose(); } } } @@ -126,6 +127,7 @@ public abstract class UnlockableContent extends MappableContent{ var result = Pixmaps.outline(base, outlineColor, outlineRadius); Drawf.checkBleed(result); packer.add(PageType.main, name, result); + result.dispose(); } } diff --git a/core/src/mindustry/graphics/MultiPacker.java b/core/src/mindustry/graphics/MultiPacker.java index 8d5fb2dd8d..e5f473a765 100644 --- a/core/src/mindustry/graphics/MultiPacker.java +++ b/core/src/mindustry/graphics/MultiPacker.java @@ -97,8 +97,12 @@ public class MultiPacker implements Disposable{ @Override public void dispose(){ - for(PixmapPacker packer : packers){ - packer.dispose(); + for(int i = 0; i < PageType.all.length; i ++){ + var packer = packers[i]; + //the UI packer's image is later used when merging with the font, don't dispose it + if(i != PageType.ui.ordinal()){ + packer.forceDispose(); + } } } diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 09dacda4db..d7dfcf16fe 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -969,6 +969,7 @@ public class UnitType extends UnlockableContent implements Senseable{ Drawf.checkBleed(outlined); packer.add(PageType.main, regionName + "-outline", outlined); + outlined.dispose(); } } @@ -1021,7 +1022,9 @@ public class UnitType extends UnlockableContent implements Senseable{ } packer.add(PageType.main, name + "-treads" + r + "-" + i, frame); + frame.dispose(); } + slice.dispose(); } } } diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index a401c896a7..5dcf542400 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -1294,6 +1294,8 @@ public class Block extends UnlockableContent implements Senseable{ } } + Seq toDispose = new Seq<>(); + //generate paletted team regions if(teamRegion != null && teamRegion.found()){ for(Team team : Team.all){ @@ -1318,6 +1320,7 @@ public class Block extends UnlockableContent implements Senseable{ Drawf.checkBleed(out); packer.add(PageType.main, name + "-team-" + team.name, out); + toDispose.add(out); } } @@ -1337,6 +1340,7 @@ public class Block extends UnlockableContent implements Senseable{ Pixmap out = last = Pixmaps.outline(region, outlineColor, outlineRadius); Drawf.checkBleed(out); packer.add(PageType.main, atlasRegion.name, out); + toDispose.add(out); } var toOutline = new Seq(); @@ -1350,6 +1354,7 @@ public class Block extends UnlockableContent implements Senseable{ Drawf.checkBleed(outlined); packer.add(PageType.main, regionName + "-outline", outlined); + toDispose.add(outlined); } } @@ -1367,12 +1372,15 @@ public class Block extends UnlockableContent implements Senseable{ packer.add(PageType.main, "block-" + name + "-full", base); editorBase = new PixmapRegion(base); + toDispose.add(base); }else{ if(gen[0] != null) packer.add(PageType.main, "block-" + name + "-full", Core.atlas.getPixmap(gen[0])); editorBase = gen[0] == null ? Core.atlas.getPixmap(fullIcon) : Core.atlas.getPixmap(gen[0]); } packer.add(PageType.editor, name + "-icon-editor", editorBase); + + toDispose.each(Pixmap::dispose); } public int planRotation(int rot){ diff --git a/core/src/mindustry/world/blocks/environment/Floor.java b/core/src/mindustry/world/blocks/environment/Floor.java index 6089faf74f..dfd29de65b 100644 --- a/core/src/mindustry/world/blocks/environment/Floor.java +++ b/core/src/mindustry/world/blocks/environment/Floor.java @@ -177,6 +177,7 @@ public class Floor extends Block{ } packer.add(PageType.environment, name + "-edge", result); + result.dispose(); } @Override diff --git a/core/src/mindustry/world/blocks/environment/OreBlock.java b/core/src/mindustry/world/blocks/environment/OreBlock.java index 15bf3448d5..f6da9d5f89 100644 --- a/core/src/mindustry/world/blocks/environment/OreBlock.java +++ b/core/src/mindustry/world/blocks/environment/OreBlock.java @@ -69,6 +69,8 @@ public class OreBlock extends OverlayFloor{ packer.add(PageType.editor, "editor-block-" + name + "-full", image); packer.add(PageType.main, "block-" + name + "-full", image); } + + image.dispose(); } } diff --git a/gradle.properties b/gradle.properties index 73d2c94b6c..50034acf47 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,4 +25,4 @@ org.gradle.caching=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=580916ccfd +archash=8d5651a6ad