Intel® Software Guard Extensions (Intel® SGX)
Discussion board focused on hardware-based isolation and memory encryption to provide extended code protection in solutions.

Free memory inside the enclave

DylanWang
Новичок
2 042Просмотр.

Hi, Team.

I'm new to SGX.

I'm not that familiar with the memory management inside the enclave.

Since I use the C++11 feature (like unique_ptr) and class objects in my sample code, how should I free memory? For class objects, some other objects are embedded.

Sample code:

test.h

class{
private:
  ClassA* ca;
  unique_ptr<ClassB> cb;
  unique_ptr<ClassC> cc;
}
 
test.cpp
ca = new ClassA*(...); // delete?
cb = make_unique<ClassB>(function(...));
cc = make_unique<ClassC>(function(...)); // Do I need to do something for this smart pointer?

 

0 баллов
1 Решение
JesusG_Intel
Модератор
2 024Просмотр.

Hello DylanWang,

 

You can use delete to free up memory from the class and unique_ptrs just as you would in non-enclave code.

 

Refer to the SGX SDK Developer Reference Guide for your OS, section C++ Language Support, for more information.

 

Sincerely,

Jesus G.

Intel Customer Support

 

Просмотреть решение в исходном сообщении

3 Ответы
JesusG_Intel
Модератор
2 025Просмотр.

Hello DylanWang,

 

You can use delete to free up memory from the class and unique_ptrs just as you would in non-enclave code.

 

Refer to the SGX SDK Developer Reference Guide for your OS, section C++ Language Support, for more information.

 

Sincerely,

Jesus G.

Intel Customer Support

 

DylanWang
Новичок
1 985Просмотр.
JesusG_Intel
Модератор
2 011Просмотр.

This thread has been marked as answered and Intel will no longer monitor this thread. If you want a response from Intel in a follow-up question, please open a new thread.


Ответить