From 6cb23926bdee8cfa3d3d82399751dbc384d564e4 Mon Sep 17 00:00:00 2001 From: yamashi Date: Sat, 30 Apr 2022 18:02:29 +0200 Subject: [PATCH] fix: memory issue with packets --- Code/client/Systems/AnimationSystem.cpp | 2 +- Code/server/GameServer.cpp | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Code/client/Systems/AnimationSystem.cpp b/Code/client/Systems/AnimationSystem.cpp index 7b1ac6059..b2414cae1 100644 --- a/Code/client/Systems/AnimationSystem.cpp +++ b/Code/client/Systems/AnimationSystem.cpp @@ -135,7 +135,7 @@ bool AnimationSystem::Serialize(World& aWorld, const ActionEvent& aActionEvent, if (!aWorld.GetModSystem().GetServerModId(aActionEvent.TargetId, targetModId, targetBaseId)) return false; - uint8_t scratch[1 << 12]; + uint8_t scratch[1 << 14]; TiltedPhoques::ViewBuffer buffer(scratch, std::size(scratch)); Buffer::Writer writer(&buffer); aActionEvent.GenerateDifferential(aLastProcessedAction, writer); diff --git a/Code/server/GameServer.cpp b/Code/server/GameServer.cpp index aa26c1a30..0790ecc7f 100644 --- a/Code/server/GameServer.cpp +++ b/Code/server/GameServer.cpp @@ -338,9 +338,7 @@ void GameServer::Send(const ConnectionId_t aConnectionId, const ServerMessage& a { static thread_local TiltedPhoques::ScratchAllocator s_allocator{1 << 18}; - ScopedAllocator _(s_allocator); - - Buffer buffer(1 << 16); + Buffer buffer(1 << 20); Buffer::Writer writer(&buffer); writer.WriteBits(0, 8); // Skip the first byte as it is used by packet @@ -356,9 +354,7 @@ void GameServer::Send(ConnectionId_t aConnectionId, const ServerAdminMessage& ac { static thread_local TiltedPhoques::ScratchAllocator s_allocator{1 << 18}; - ScopedAllocator _(s_allocator); - - Buffer buffer(1 << 16); + Buffer buffer(1 << 20); Buffer::Writer writer(&buffer); writer.WriteBits(0, 8); // Skip the first byte as it is used by packet