memory leak fixes
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-27 22:53:49 -04:00
parent 1412b2ed07
commit e2e3dcf2c9
5 changed files with 28 additions and 6 deletions

View File

@ -2011,6 +2011,7 @@ More profiling
(05/27/2025)
QuadMesh memory pooling
Load characters from save db when re-loading valid save
Fix memory leaks

View File

@ -55,7 +55,7 @@ public class ServerCollidableTree implements BehaviorTree {
ServerGravityTree.getServerGravityTree(parent).start();
}
}
if(impulse.type.matches(Collidable.TYPE_WORLD_BOUND)){
if(impulse.type.matches(Collidable.TYPE_WORLD_BOUND) || impulse.type.matches(Collidable.TYPE_STATIC)){
this.resetGravityFall();
}
}

View File

@ -53,7 +53,9 @@ public class JomlPool {
data.y = 0;
data.z = 0;
lock.lock();
JomlPool.vec3fPool.add(data);
if(JomlPool.vec3fPool.size() < 1000){
JomlPool.vec3fPool.add(data);
}
lock.unlock();
}
@ -82,7 +84,9 @@ public class JomlPool {
data.y = 0;
data.z = 0;
lock.lock();
JomlPool.vec3dPool.add(data);
if(JomlPool.vec3dPool.size() < 1000){
JomlPool.vec3dPool.add(data);
}
lock.unlock();
}

View File

@ -154,25 +154,45 @@ public class MessagePool {
public void release(NetworkMessage message){
lock.lock();
if(message instanceof EntityMessage){
if(entityMessagePool.size() < 1000){
entityMessagePool.add(message);
}
} else if(message instanceof LoreMessage){
if(loreMessagePool.size() < 1000){
loreMessagePool.add(message);
}
} else if(message instanceof PlayerMessage){
if(playerMessagePool.size() < 1000){
playerMessagePool.add(message);
}
} else if(message instanceof TerrainMessage){
if(terrainMessagePool.size() < 1000){
terrainMessagePool.add(message);
}
} else if(message instanceof ServerMessage){
if(serverMessagePool.size() < 1000){
serverMessagePool.add(message);
}
} else if(message instanceof AuthMessage){
if(authMessagePool.size() < 1000){
authMessagePool.add(message);
}
} else if(message instanceof CharacterMessage){
if(characterMessagePool.size() < 1000){
characterMessagePool.add(message);
}
} else if(message instanceof InventoryMessage){
if(inventoryMessagePool.size() < 1000){
inventoryMessagePool.add(message);
}
} else if(message instanceof SynchronizationMessage){
if(synchronizationMessagePool.size() < 1000){
synchronizationMessagePool.add(message);
}
} else if(message instanceof CombatMessage){
if(combatMessagePool.size() < 1000){
combatMessagePool.add(message);
}
} else {
throw new Error("Unsupported message type! " + message.getClass());
}

View File

@ -3,7 +3,6 @@ package electrosphere.server.macro.character;
import org.joml.Vector3d;
import org.joml.Vector3i;
import electrosphere.collision.PhysicsEntityUtils;
import electrosphere.engine.Globals;
import electrosphere.entity.Entity;
import electrosphere.entity.state.server.ServerCharacterData;
@ -61,8 +60,6 @@ public class PlayerCharacterCreation {
//must come after the player is assigned, otherwise the player will not get the item attachment messages
CreatureUtils.serverApplyTemplate(realm, newPlayerEntity, template);
PhysicsEntityUtils.disableBody(realm.getCollisionEngine(), newPlayerEntity);
//if macro data hasn't been generated in this area, generate it
//but only if it's a player's entity
realm.updateMacroData(spawnPoint);