mFrame
載入中...
搜尋中...
無符合項目
ufm::sys::Allocator 結構 參考文件abstract

[Interface] 記憶體分配器介面 更多...

#include <Allocator.h>

類別ufm::sys::Allocator的繼承圖:
ufm::sys::DefaultAllocator ufm::sys::Stacker

公開方法(Public Methods)

virtual void * alloc (int size) override
 分配指定大小的記憶體
 
virtual bool free (void *ptr, int size=0) override
 釋放先前分配的記憶體
 
virtual int getFree (void) override
 取得剩餘的可用記憶體數量
 
virtual int getTotal (void) override
 取得總記憶體大小
 

詳細描述

[Interface] 記憶體分配器介面

基本的記憶體分配和釋放功能介面,用於系統記憶體管理。 實作此介面的類別需要提供具體的記憶體分配策略。

1.0.0

函式成員說明文件

◆ alloc()

virtual void * ufm::sys::Allocator::alloc ( int size)
pure virtual

分配指定大小的記憶體

參數
size要分配的記憶體大小,以位元組(bytes)為單位
傳回值
void* 分配成功時返回記憶體的指標,分配失敗時返回 nullptr

實作於 ufm::sys::DefaultAllocator, 及 ufm::sys::Stacker.

◆ free()

virtual bool ufm::sys::Allocator::free ( void * ptr,
int size = 0 )
pure virtual

釋放先前分配的記憶體

參數
ptr要釋放的記憶體指標,此指標必須是由 alloc 方法分配的
size要釋放的記憶體大小,某些實作可能需要此參數,預設為 0
傳回值
true 記憶體成功釋放
false 記憶體釋放失敗

實作於 ufm::sys::DefaultAllocator, 及 ufm::sys::Stacker.

◆ getFree()

virtual int ufm::sys::Allocator::getFree ( void )
pure virtual

取得剩餘的可用記憶體數量

傳回值
int 目前尚可使用的記憶體大小,以位元組(bytes)為單位

實作於 ufm::sys::DefaultAllocator, 及 ufm::sys::Stacker.

◆ getTotal()

virtual int ufm::sys::Allocator::getTotal ( void )
pure virtual

取得總記憶體大小

傳回值
int 系統總記憶體大小,以位元組(bytes)為單位

實作於 ufm::sys::DefaultAllocator, 及 ufm::sys::Stacker.


此結構(structure) 文件是由下列檔案中產生: