Skip to content

Commit

Permalink
fix Memory leak in Unloader
Browse files Browse the repository at this point in the history
  • Loading branch information
way-zer committed Jul 28, 2024
1 parent 6ef416d commit 0468342
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions patches/picked/0003-FIX-early-release-Ankuen-10066.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: way-zer <[email protected]>
Date: Sun, 28 Jul 2024 23:52:46 +0800
Subject: [PATCH] FIX early release #Ankuen:10066

---
core/src/mindustry/world/blocks/storage/Unloader.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/core/src/mindustry/world/blocks/storage/Unloader.java b/core/src/mindustry/world/blocks/storage/Unloader.java
index a7076762221515ba44b5ca78e7e9a1e37740e0c0..cb5a9f3a516f89589436c03395c67f1c0265c6ea 100644
--- a/core/src/mindustry/world/blocks/storage/Unloader.java
+++ b/core/src/mindustry/world/blocks/storage/Unloader.java
@@ -7,6 +7,7 @@ import arc.struct.*;
import arc.util.*;
import arc.util.io.*;
import arc.util.pooling.*;
+import arc.util.pooling.Pool.*;
import mindustry.annotations.Annotations.*;
import mindustry.entities.units.*;
import mindustry.gen.*;
@@ -58,17 +59,22 @@ public class Unloader extends Block{
removeBar("items");
}

- public static class ContainerStat{
+ public static class ContainerStat implements Poolable{
Building building;
float loadFactor;
boolean canLoad;
boolean canUnload;
int lastUsed;

+ @Override
+ public void reset(){
+ building = null;
+ }
+
@Override
public String toString(){
return "ContainerStat{" +
- "building=" + building.block + "#" + building.id +
+ "building=" + (building != null ? (building.block + "#" + building.id) : "null") +
", loadFactor=" + loadFactor +
", canLoad=" + canLoad +
", canUnload=" + canUnload +

0 comments on commit 0468342

Please sign in to comment.