Difference between malloc and LocalAlloc
-
Hi, I will like to know what is the difference between malloc and localalloc? Thanks.
-
Hi, I will like to know what is the difference between malloc and localalloc? Thanks.
look at return values at first (and than at LocalLock/Unlock help) and: The global and local functions supported for porting from 16-bit code, or maintaining source code compatibility with 16-bit Windows. The global and local 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 and the clipboard functions. Windows 95/98/Me: The heap managers are designed for memory blocks smaller than four megabytes. If you expect your memory blocks to be larger than one or two megabytes, you can avoid significant performance degradation by using the VirtualAlloc or VirtualAllocEx function instead.
-
look at return values at first (and than at LocalLock/Unlock help) and: The global and local functions supported for porting from 16-bit code, or maintaining source code compatibility with 16-bit Windows. The global and local 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 and the clipboard functions. Windows 95/98/Me: The heap managers are designed for memory blocks smaller than four megabytes. If you expect your memory blocks to be larger than one or two megabytes, you can avoid significant performance degradation by using the VirtualAlloc or VirtualAllocEx function instead.
Hi, thanks for your reply.:) So do you mean both malloc and LocalAlloc actually allocates memory from the heap? So I guess the main difference is really it's portability then, isn't it?
-
Hi, thanks for your reply.:) So do you mean both malloc and LocalAlloc actually allocates memory from the heap? So I guess the main difference is really it's portability then, isn't it?
easiest is to look into malloc.c directly (in my case \Program Files\Microsoft Visual Studio\VC98\CRT\SRC) you can find HeapAlloc there (#ifdef WINHEAP)