Skip to content

Commit

Permalink
fix: memory issue with packets
Browse files Browse the repository at this point in the history
  • Loading branch information
Yamashi committed Apr 30, 2022
1 parent c8ed2ac commit 6cb2392
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Code/client/Systems/AnimationSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 2 additions & 6 deletions Code/server/GameServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit 6cb2392

Please sign in to comment.