memory allocation
Hi,
What is the differences between : GlobalAlloc / LocalAlloc / HeapAlloc ?
What is better ? what is faster ?
Which should i use ?
Thanks
GlobalAlloc and LocalAlloc are only included for compatability with 16-bit versions of Windows. If you''re building a Win32 app, you should use HeapAlloc, despite how much of a pain it can be at times.
As far as I know, there is no particular difference in speed, but that said, I''ve never timed it...
As far as I know, there is no particular difference in speed, but that said, I''ve never timed it...
out of the blue: I use malloc() and free(). I''m not sure if its the right thing todo, but it works for me.
-J
-J
I know malloc() and free() don''t call ctors/dtor like new and delete do but what about HeapAlloc?
Nope, all it does is allocate memory, not create objects.
Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
If you look at the source for
The basic point is that
codeka.com - Just click it.
malloc
it calls HeapAlloc
internally (well, on windows it does, there''s probably some other system call on other platforms).The basic point is that
malloc
, free
, new
and delete
are portable, while HeapAlloc
& co. are not. codeka.com - Just click it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement