如何在圍場內釋放物件Intel® Software Guard Extensions (Intel® SGX) ?
內容類型: 產品資訊與文件 | 文章 ID: 000059846 | 最近查看日期: 2021 年 08 月 10 日
在飛區內, 使用 C++ delete 運算子以釋放先前分配給類、unique_ptrs和其他使用新運算子 的物件的記憶體。新增和 刪除 的 運算子在飛 區內的行為與一般 C++ 應用程式中的行為相同。
範例代碼:
test.h:
class{
private:
ClassA* ca;
unique_ptr cb;
}
test.cpp:
//Use new to instantiate the class and unique_ptr objects
ca = new ClassA*(...);
cb = make_unique(function(...));
//Use delete to free the memory previously allocated with new
delete ClassA;
delete cb;
有關作業系統的資訊,請參閱 Intel® Software Guard Extensions (Intel® SGX) SDK 開發人員參考指南中的C++語言支援 一節。