At 04:08 PM 11/7/2000, Tilo Christ wrote:
>I have a question about locking and releasing handles to memory. The
>Palm OS Reference states I should release locked memory as soon as
>possible, whereas some posts on this forum suggest locking/releasing
>will take up valuable CPU cycles and not releasing as soon as possible
>might not be that harmful after all.
The reason to unlock handles is to allow the memory manager to shuffle things around
to make room. If you're doing something that requires speed, you probably want to
avoid allocating memory during the operation, which means there is no need to unlock
handles during the operation either. I'd suggest using a debugger to isolate the 10%
of the code that runs 90% of the time, and if lock/unlock or memory allocation is a
significant portion of that 90%, keep the handle locked for the entire duration of the
operation. Unless you've done profiling and found that it's a problem, I wouldn't
worry about it.
--
Peter Epstein
Palm Inc. Developer
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/