Also, I am not sur if MemPtrFree will work. It PROBABLY will, but since you've got the handle, it's faster to do MemHandleFree(h) anyway.
MemPtrFree will work fine with both storage heap and dynamic heap chunks.
Also a nit, in the current implementation MemPtrFree is very slightly faster than MemHandleFree. However, it's not enough faster to consider keeping a pointer around if you don't need it otherwise.
You *can* free a locked handle, and it's definitely faster to call MemPtrFree than to call MemHandleUnlock and MemHandleFree, or to call MemPtrRecoverHandle.
Having said all that, for the most part your performance problems are not going to be in the code that cleans up memory, so in general you'll be much better off writing consistent, clear code than trying to optimize every last cycle out of this stuff.
--Bob
