nn::nex::PacketBufferManager Class

Syntax

class PacketBufferManager : public nn::nex::RootObject

Description

Packet buffer memory management class for P2P communication.

Within NEX memory allocation, the packet buffer manager performs memory management for P2P communication.

The packet buffer manager is a feature that allocates a dedicated memory pool (the packet buffer pool) as a batch process before starting P2P communication, and then allocates memory from that packet buffer pool according to packet buffer memory allocation requests.

Memory allocation for the packet buffer pool is allocated with the same method as other NEX objects.

Because packet buffer pools are allocated with a pre-decided size limit, this can prevent the entire NEX memory from being depleted by memory consumption when sending or receiving a large packet.

The packet buffers used with the following are not managed with the packet buffer manager but have the same memory management as other NEX objects.
· Communication with the server
· Communication by CoreDO within multiple objects
· Sending or receiving data that exceeds the maximum memory block size (1364 bytes) that can be allocated with the packet buffer manager

The packet buffer pool is allocated before starting P2P communication and is deallocated when P2P communication stops. Specifically, it is allocated the moment the ConnectivityManager::StartNATSession, NetZ::NetZ, or VSocket::Open function is called and deallocated when the ConnectivityManager::StopNATSession, NetZ::~NetZ, or VSocket::Close function is called.

The packet buffer pool is managed by using multiple unit heaps and is used to allocate objects used for managing packets attached to payloads that are not packet payloads. Of these, for the payload unit heap, the unit size and number of memory blocks can be customized on the application side. Customize according to the application communication data size.

Packet buffer allocation attempts memory allocation from the unit heap with the smallest unit size and uses the first unit heap that can be allocated. If allocation is not possible even with the largest unit heap, the packet buffer pool is depleted.

Structures

nn::nex::PacketBufferManager::UnitHeapDebugInfo Memory allocation information for the unit heap used internally by the packet buffer manager.
nn::nex::PacketBufferManager::UnitHeapParam Structural information for the unit heap used internally by the packet buffer manager.

Member Functions

S GetRequiredMemorySize Returns the size of the required packet buffer pool based on the unit heap structure information for the passed payload.
S GetSimpleUnitHeapParam Calculates and returns the simple structure for the unit heap based on the packet buffer pool size and the average send data size.
S SetUnitHeapParam Sets the structural information for the unit heap for the payload used by the packet buffer manager.
S GetUnitHeapParam Gets the structural information of the unit heap for the payload used by the packet buffer manager. If not set with the SetUnitHeapParam function, returns the structural information used by default.
S GetUnitHeapDebugInfo Gets the memory allocation information of the unit heap for the payload used by the packet buffer manager. Gets the correct value only when the packet buffer manager is running.
S ResetUnitHeapDebugInfo Resets the memory allocation information of the unit heap for the payload used by the packet buffer manager.
S IsActive Returns whether the packet buffer manager is running. When running, the unit heap structure cannot be changed.
S EnablePacketBufferPool Sets whether to use the packet buffer pool. The default is true. When set to false, the packet buffer is allocated by the default memory manager. This value cannot be changed when the packet buffer manager is running. The set values are maintained until NEX terminates.
S IsEnablePacketBufferPool Returns whether to use the packet buffer pool. The default is true.

Class Hierarchy

nn::nex::RootObject
  nn::nex::PacketBufferManager

Revision History

2012/11/27
Initial version.

CONFIDENTIAL