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

Why do I fail to malloc(1600000)?

li__caihua
Beginner
407 Views

Hi folk,

Today I found that I fail to malloc(1600000) in enclave (the return value is NULL). Obviously, 1600000 bytes is just about 1.5M.

 

void printf(const char *fmt, ...)
{
    const int size = 1600000;
    char* bytearray = NULL;
    bytearray = (char*)malloc(size);
 
    std::string buf = "OK!\n";
    if (bytearray == NULL) buf = "Fail!\n";
    ocall_print_string(buf.c_str());
}
 
Many thanks,
Caihua
0 Kudos
1 Reply
Rodolfo_S_
New Contributor III
407 Views

Hi,

Can you tell what was the maximum heap size that you set on the config.xml file?

Regards,

Rodolfo

0 Kudos
Reply