> MemPtrNew() allocates a non-moveable chunk.  It's stuck in one place in
> memory and can't be moved to make room for other allocations that may
> occur.  Not really a good thing if you're allocating memory to hang onto
> for a while.

It's a good thing if you are going to have the memory locked the entire time
you are hanging on to the chunk.  Allocating a chunk via pointer allocates
the chunk at the opposite end of the heap that allocating via a handle does.
So if you use MemPtrNew you don't have a locked chunk in the way when the OS
tries to clean up the heap.

Matt Henry
www.Iliumsoft.com

"Brian Smith" <[EMAIL PROTECTED]> wrote in message
news:92592@palm-dev-forum...
>
> On Wed, 31 Jul 2002, Syed Najeebullah Hussaini wrote:
>
> > May i know whats the difference in between Movable and Non Movable Chunk
> > in a Dynamic heap. In what situations, can one use this Chunks
>
> MemPtrNew() allocates a non-moveable chunk.  It's stuck in one place in
> memory and can't be moved to make room for other allocations that may
> occur.  Not really a good thing if you're allocating memory to hang onto
> for a while.
>
> MemHandlePtr() allocates a moveable chunk and returns a handle.  When you
> need to access it, you lock it and unlock it.  Locking it temporarily
> makes it non-moveable and returns a pointer that you can use the access
> the memory.  Otherwise, the OS is free to move the chunk around as needed
> to satisfy other allocation requests.
>
> -----------------------------------------------------------------------
> Brian Smith // avalon73 at arthurian dot nu // http://www.arthurian.nu/
> Software Developer  //  Gamer  //   Webmaster  //  System Administrator
> "Senate, n.: A body of elderly gentlemen charged with high duties and
>  misdemeanors."  -- Ambrose Bierce
>
>
>
>



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to