Memory 如何判断哪些调用malloc失败?
我这里的内存是一个32字节的数组,地址从0到31,如果且仅当 如果内存中有n+1个连续的可用字节Memory 如何判断哪些调用malloc失败?,memory,malloc,Memory,Malloc,我这里的内存是一个32字节的数组,地址从0到31,如果且仅当 如果内存中有n+1个连续的可用字节 1: malloc(2) 2: free(1) 3: malloc(14) 4: free(1) 5: malloc(2) 6: free(1) 7: malloc(11) 8: malloc(6) 9: malloc(11) 10: free(20) 11: malloc(6) 12: malloc(14) 13: malloc(13) 14: malloc(1) 15: free(27) 16:
1: malloc(2)
2: free(1)
3: malloc(14)
4: free(1)
5: malloc(2)
6: free(1)
7: malloc(11)
8: malloc(6)
9: malloc(11)
10: free(20)
11: malloc(6)
12: malloc(14)
13: malloc(13)
14: malloc(1)
15: free(27)
16: malloc(2)
17: malloc(5)
18: malloc(1)
19: free(27)
20: free(20)
我主要是寻求帮助,了解如何区分哪个失败,而不是哪个失败,如果这是有意义的,谢谢