• 首頁
  • 文件
  • 下載
  • 狀態
  • 常見問題
  • 郵件列表
  • 應用程式
  • 外部鏈結
  • 版權
  • 志願者
  • 聯繫

類別:Allocator

記憶體配置統一管理

類型 使用 成員 說明
建構子 public Allocator(void)
解構子 public ~Allocator(void)
函式 public static void * allocate(long size) 配置記憶體。
函式 public static void free (void * block) 釋放記憶體。
函式 public static int blocks (void) 記憶體配置區塊數量。

建議

所有CIOS Audio Core內部的程式,都被建議使用Allocator來配置及釋放記憶體。

C/C++定義

class Allocator
{
  public:

    explicit      Allocator (void) ;
    virtual      ~Allocator (void) ;

    static void * allocate  (long size) ;
    static void   free      (void * block) ;
    static int    blocks    (void) ;

};

範例


配置1024位元的記憶體。
char * buffer ;
buffer = (char *)Allocator::allocate(1024) ;

釋放記憶體。
Allocator::free(buffer) ;