64 bit large mallocs

后端 未结 9 1957
情话喂你
情话喂你 2020-11-28 13:18

What are the reasons a malloc() would fail, especially in 64 bit?

My specific problem is trying to malloc a huge 10GB chunk of RAM on a 64 bit system. The machine ha

9条回答
  •  春和景丽
    2020-11-28 14:24

    Have you tried using VirtualAlloc() and VirtualFree() directly? This may help isolate the problem.

    • You'll be bypassing the C runtime heap and the NT heap.
    • You can reserve virtual address space and then commit it. This will tell you which operation fails.

    If the virtual address space reservation fails (even though it shouldn't, judging from what you've said), Sysinternals VMMap may help explain why. Turn on "Show free regions" to look at how the free virtual address space is fragmented.

提交回复
热议问题