0

I'm running an app with sgx. It's memory usage is less than 128M, I'm sure about that.

0x752EEB22 (KernelBase.dll)处(位于 test-sgx-align.exe 中)引发的异常: 0xA1A01EC1 (参数:0x13B1CDA8)。
0x79021168 (sgx_urts.dll)处(位于 test-sgx-align.exe 中)引发的异常: 0xC000001D: Illegal Instruction。
0x79021168 (sgx_urts.dll) (test-sgx-align.exe 中)处有未经处理的异常: 0xC000001D: Illegal Instruction。
程序“[25268] test-sgx-align.exe”已退出,返回值为 0 (0x0)。

As you see.

sign the enclave
The required memory is 0x18b000.
    <EnclaveConfiguration>
    <ProdID>0</ProdID>
    <ISVSVN>0</ISVSVN>
    <StackMaxSize>0x40000</StackMaxSize>
    <HeapMaxSize>0x100000</HeapMaxSize>
    <TCSNum>1</TCSNum>
    <TCSPolicy>1</TCSPolicy>
Succeed.

Maybe I should change the and .I have done it in my compiler(vs2017_pro), but it seems that the setting doesn't work.

Here is the problem code. The numbers n1 and n2 are between 100 and 10000.

    paths = new short*[n1 + 1];
    scores = new short*[n1 + 1];

    for (int i = 0; i < n1 + 1; i++)
    {
        paths[i] = new short[n2 + 1]();
        scores[i] = new short[n2 + 1]();
    }

I am sorry that there are some Chinese words in my question. Can anyone help me? Thanks.

TBA
  • 1,921
  • 4
  • 13
  • 26
zean_yyf
  • 1
  • 1
  • 1
    If n1=n2=10000 then you allocate at least 4*10000*10000 bytes, which is about 400MB. That’s definitely greater than 128MB. – nneonneo Dec 25 '21 at 08:19
  • @nneonneo Thanks for your comment. I have realize this problem,and I have tried the n1=414,n2=551,It has the same error. – zean_yyf Dec 25 '21 at 08:39
  • 1
    Unless you need to re-arrange rows of a matrix, it's normally better to use one large allocation of an actual 2D array, `new short[n1+1][n2+1]`, instead of making an array of pointers and then allocating each row separately. (Unless maybe you want paths[i] and scores[i] to be likely to be next to each other in memory, for cache locality, since you're interleaving allocations of rows.) One fewer levels of indirection is good; indexing by doing some multiply/add is faster than loading a pointer and adding to it. – Peter Cordes Dec 25 '21 at 14:14

0 Answers0