MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / CreateMessageBuffers

Method CreateMessageBuffers

Source/Engine/Networking/NetworkPeer.cpp:83–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83void NetworkPeer::CreateMessageBuffers()
84{
85 PROFILE_MEM(Networking);
86 ASSERT(MessageBuffer == nullptr);
87
88 const uint32 pageSize = Platform::GetCPUInfo().PageSize;
89
90 // Calculate total size in bytes
91 const uint64 totalSize = static_cast<uint64>(Config.MessagePoolSize) * Config.MessageSize;
92
93 // Calculate the amount of pages that we need
94 const uint32 numPages = totalSize > pageSize ? Math::CeilToInt(totalSize / static_cast<float>(pageSize)) : 1;
95
96 MessageBuffer = static_cast<uint8*>(Platform::AllocatePages(numPages, pageSize));
97 Platform::MemorySet(MessageBuffer, 0, numPages * pageSize);
98}
99
100void NetworkPeer::DisposeMessageBuffers()
101{

Callers

nothing calls this directly

Calls 2

MemorySetFunction · 0.85
CeilToIntFunction · 0.50

Tested by

no test coverage detected