From accf7d32b830da3ad0923f584d06cb196402de38 Mon Sep 17 00:00:00 2001 From: austin Date: Sun, 25 May 2025 22:08:44 -0400 Subject: [PATCH] client collidable memory leak fix --- docs/src/progress/renderertodo.md | 1 + src/main/java/electrosphere/collision/PhysicsEntityUtils.java | 1 + .../java/electrosphere/entity/state/lod/ClientLODComponent.java | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 384aa686..2b9df15b 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1997,6 +1997,7 @@ Performance improvements - Increase memory limit 6GB->8GB - Server block chunk disk map writes directly to output stream instead of inbetween buffer - No-allocation block chunk read/write in disk map + - Fix client collidable memory leak Increase human move speed LOD components re-attach physics VectorPool->JomlPool diff --git a/src/main/java/electrosphere/collision/PhysicsEntityUtils.java b/src/main/java/electrosphere/collision/PhysicsEntityUtils.java index a856ca82..5fce4fb0 100644 --- a/src/main/java/electrosphere/collision/PhysicsEntityUtils.java +++ b/src/main/java/electrosphere/collision/PhysicsEntityUtils.java @@ -101,6 +101,7 @@ public class PhysicsEntityUtils { ); rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform); rVal.putData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE, physicsTemplate); + rVal.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable); Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE); engine.registerCollisionObject(geom, collidable); diff --git a/src/main/java/electrosphere/entity/state/lod/ClientLODComponent.java b/src/main/java/electrosphere/entity/state/lod/ClientLODComponent.java index 5add88c2..ca6d935f 100644 --- a/src/main/java/electrosphere/entity/state/lod/ClientLODComponent.java +++ b/src/main/java/electrosphere/entity/state/lod/ClientLODComponent.java @@ -55,7 +55,7 @@ public class ClientLODComponent implements BehaviorTree { cachedLodLevel = lodLevel; if(cachedLodLevel == ServerLODComponent.FULL_RES){ CommonEntityType type = CommonEntityUtils.getCommonData(this.parent); - if(type.getCollidable() != null){ + if(type.getCollidable() != null && PhysicsEntityUtils.getCollidable(this.parent) == null){ PhysicsEntityUtils.clientAttachCollidableTemplate(parent, type.getCollidable()); } } else if(cachedLodLevel == ServerLODComponent.LOW_RES){