Use the "sgx_emmt" tool to determine the amount of stack and heap memory to allocate for an enclave in the enclave configuration file.
- In the enclave configuration file, specified the StackMaxSize and HeapMaxSize to 32 GB each to ensure enough memory is allocated for the enclave.
- Compilation failed because the requested memory is too large.
Refer to the Enclave Memory Measurement Tool section in the SGX Developer Reference for Linux* (available in Intel® SGX Linux Latest Docs) for details on using sgx_emmt to measure the real usage of protected memory by the enclave at runtime.
Currently, the enclave memory measurement tool provides the following functions:
- Get the stack peak usage value for the enclave.
- Get the heap peak usage value for the enclave.
- Get the reserved memory peak usage value for the enclave.
The tool reports the size of the memory usage in KB. After you get accurate memory usage information for your enclaves, edit the enclave configuration file based on this information to make full use of the protected memory.
If the StackMaxSize and HeapMaxSize in the enclave configuration file are more than the available memory in the system, compilation or runtime memory errors may occur.
The latest SGX Developer Reference for Linux is in Intel® SGX Linux Latest Docs