Advertisement

Handle-based vs Pointer-based mem. allocation?

Started by April 16, 2001 05:39 PM
1 comment, last by Jofunk 23 years, 9 months ago
I was wondering if anyone could take the time to explain to me the differences between handle-based and pointer-based memory allocation and what the advantages and disadvantages of each are? Any help would be appreciated, thanks. Jofunk
Well handles are mostly a hang over from the days before virtual memory management.
You allocated a new object which was stored outside the normal memory map (ie. in XMS/EMS memory or in Video RAM) which couldn''t be accessed from DOS/Windows 286-386. When you wanted to access the object, you had to lock it (where the operating system would copy it into the standard memory map). This method also allowed for the OS to do garbage collection on unlocked objects.

Handles have the advantage of providing a layer of protection to hide internal stuff.

So for Windose game programming, pointer will be a fraction quicker - since no lock/memcpy/unlock is required.
Advertisement
Thanks for clearing things up for me =).

Jofunk

This topic is closed to new replies.

Advertisement