如上

解决方案 »

  1.   

    HeapAlloc is the basic Win32 API for heap allocation. It can allocate from any Win32 heap.GlobalAlloc is from the old Win16 API for heap allocation. It allocates from the default process heap. So the function is there to be compatible with older Windows source code. GlobalAlloc is implemented using HeapAlloc.There could be some differences. For example, you can have a thread with its private heap. Because it's private, you do not need to worry about being multi-thread safe. Then you can use HeapAlloc/HeapFree within the thread using the private heap.GlobalAlloc has to be multi-thread safe. So in this case, HeapAlloc/HeapFree on private heap can be faster than calling GlobalAlloc/GlobalFree.www.fengyuan.com