VirtualAlloc
|
HeapAlloc
|
malloc
|
new
|
A low-level, Windows API that provides lots of options, but is mainly useful for people in fairly specific situations. Can only allocate memory in (edit: not 4KB) larger chunks. There are situations where you need it, but you'll know when you're in one of these situations. One of the most common is if you have to share memory directly with another process. Don't use it for general-purpose memory allocation. Use VirtualFree to deallocate.
|
Allocates whatever size of - memory you ask for, not in big chunks than VirtualAlloc. HeapAllocknows when it needs to call VirtualAlloc and does so for you automatically. Like malloc, but is Windows-only, and provides a couple more options. Suitable for allocating general chunks of memory. Some Windows APIs may require that you use this to allocate memory that you pass to them, or use its companion HeapFree to free memory that they return to you.
|
The C way of allocating memory. Prefer this if you are writing in C rather than C++, and you want your code to work on e.g. Unix computers too, or someone specifically says that you need to use it. Doesn't initialise the memory. Suitable for allocating general chunks of memory, like HeapAlloc. A simple API. Use free to deallocate. Visual C++'s malloc calls HeapAlloc.
|
The C++ way of allocating memory. Prefer this if you are writing in C++. It puts an object or objects into the allocated memory, too. Use delete to deallocate. Visual studio's new calls HeapAlloc, and then maybe initialises the objects, depending on how you call it.
|
I am an expert in WinCE driver to BSP development. I am too excellent in Linux development. I offer my services as consultant. Do mail me: exebinary@gmail.com Deeply involve in debugging and development activity. I am also available for training in Asia and International destination.
Wednesday, December 3, 2014
VirtualAlloc | HeapAlloc | malloc | new [WinCE]
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Please add your valuable feedback and suggestion...
Note: Only a member of this blog may post a comment.