diff b/w heapalloc and new
-
new
usesHeapAlloc
internally. But it also adds caching and small block heaps and the like on top of it.new
is a C++ keyword where asHeapAlloc
is a Win32 API function. Steve -
new
usesHeapAlloc
internally. But it also adds caching and small block heaps and the like on top of it.new
is a C++ keyword where asHeapAlloc
is a Win32 API function. Steve -
Thanks for the answer. But i want to know is there any thing like private heap and Global heap? Pls help me never say die
No. Win32 supports multiple heaps, you can create your own by calling
HeapCreate
and keep it to yourself - I guess in that case you could consider it private. Can you explain what you’re trying to do specifically? Maybe then I can be of more help. Steve -
No. Win32 supports multiple heaps, you can create your own by calling
HeapCreate
and keep it to yourself - I guess in that case you could consider it private. Can you explain what you’re trying to do specifically? Maybe then I can be of more help. SteveActually a project has been given to me which connects the client to IIS Server via soap.I have been assigned to devlope further.So any memory allocation done on Server Side using Heapalloc. When I asked the reason ,i was told that memory is bound(within) to the process so it has been done using HeapAlloc. If u can help me further,I would be thankful to u never say die
-
Actually a project has been given to me which connects the client to IIS Server via soap.I have been assigned to devlope further.So any memory allocation done on Server Side using Heapalloc. When I asked the reason ,i was told that memory is bound(within) to the process so it has been done using HeapAlloc. If u can help me further,I would be thankful to u never say die
Calling
new
in C++ gets its memory fromHeapAlloc
underneath the hood. But it integrates with the language by: - Knowing the size of the object it’s allocating (so you don't have to supply it). - Calls constructors (anddelete
calls destructors). - Avoids casts. In short I'd just usenew
anddelete
. But beware: If you allocate withnew
you must free withdelete
and if you allocate withHeapAlloc
you must free it withHeapFree
- You can't allocate some memory withnew
and free the same memory withHeapFree
for example. Steve -
Calling
new
in C++ gets its memory fromHeapAlloc
underneath the hood. But it integrates with the language by: - Knowing the size of the object it’s allocating (so you don't have to supply it). - Calls constructors (anddelete
calls destructors). - Avoids casts. In short I'd just usenew
anddelete
. But beware: If you allocate withnew
you must free withdelete
and if you allocate withHeapAlloc
you must free it withHeapFree
- You can't allocate some memory withnew
and free the same memory withHeapFree
for example. Steve -
That means if a memory allocation requires construtor for intialization then use new rather than HeapAlloc never say die
You could use the a placment new but that's rather advanced. Steve
-
You could use the a placment new but that's rather advanced. Steve