GlobalAlloc的 可移动的内存 是怎么个意思?
在栈上分配的临时变量内存效率高,但是可分配的容量有限。那这个到底多大才算大?最大多少?
我看GlobalAlloc和Heapalloc都是在堆上分配,前者功能更强大,完全可以取代后者吧?

解决方案 »

  1.   

    我看GlobalAlloc和Heapalloc都是在堆上分配,前者功能更强大,完全可以取代后者吧?
    =============
    恰恰相反,GlobalAlloc应该是旧函数,MSDN建议用heap函数:
    Note  The global functions are slower than other memory management functions and do not provide as many features. Therefore, new applications should use the heap functions. However, the global functions are still used with DDE, the clipboard functions, and OLE data objects.
      

  2.   

    你要追求功能强大应该考虑VirtualAlloc
    可以移动的内存,当然指内存的物理位置可以改变,系统可以根据实际情况在分配后调整内存的位置,而保持你HGLOBAL不变
      

  3.   

    Windows memory management does not provide a separate local heap and global heap.