Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

DarkEmpire

memory allocation

This topic is 6010 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, What is the differences between : GlobalAlloc / LocalAlloc / HeapAlloc ? What is better ? what is faster ? Which should i use ? Thanks

Share this post


Link to post
Share on other sites
Advertisement
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...

Share this post


Link to post
Share on other sites
I know malloc() and free() don''t call ctors/dtor like new and delete do but what about HeapAlloc?

Share this post


Link to post
Share on other sites
If you look at the source for 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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!