Community
cancel
Showing results for 
Search instead for 
Did you mean: 
li__caihua
Beginner
87 Views

Why do I fail to malloc(1600000)?

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
87 Views

Hi,

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

Regards,

Rodolfo

Reply