ngl_server 1.0
基于 Actor 模型的 C++ 服务器框架
ngl::pack_head_pool Class Reference

pack_head对象的内存池。 More...

#include <pack_head.h>

Inheritance diagram for ngl::pack_head_pool:
ngl::buff_pool< enum_pack_head_pool_bytes, 1 >

Static Public Member Functions

static char * malloc ()
 从内存池分配一个pack_head对象。
static void free (char *p)
 将pack_head对象释放回内存池。
Static Public Member Functions inherited from ngl::buff_pool< enum_pack_head_pool_bytes, 1 >
static void track_alloc (holder &aholder, int16_t aindex)
static void maybe_flush (holder &aholder)
static bucket_stats aggregate_global_stats ()
static bucket_stats aggregate_bucket_stats (int abucket_idx)
static std::vector< uint64_t > get_bucket_peak_per_thread (int abucket_idx)
static constexpr std::array< int32_t, TCOUNT > get_bytes ()

Additional Inherited Members

Public Member Functions inherited from ngl::buff_pool< enum_pack_head_pool_bytes, 1 >
 buff_pool (const std::array< int32_t, TCOUNT > &acounts)
char * malloc_private (int32_t abytes)
void free_private (char *abuff)
const std::array< int32_t, TCOUNT > & get_counts () const
void print_stats () const

Detailed Description

pack_head对象的内存池。

继承自buff_pool,用于分配和释放pack_head对象,减少内存碎片。 使用单例模式,确保全局只有一个内存池实例。

Member Function Documentation

◆ free()

void ngl::pack_head_pool::free ( char * p)
inlinestatic

将pack_head对象释放回内存池。

Parameters
p要释放的内存指针。

◆ malloc()

char * ngl::pack_head_pool::malloc ( )
inlinestatic

从内存池分配一个pack_head对象。

Returns
分配的内存指针,如果分配失败返回nullptr。

The documentation for this class was generated from the following file: