Thanks Jeff for clarifying the part on
MemHandleFree().
Thanks to that I have been able to focus on the memory
leaks: in my attempt to resolve the MemHandle-problem
(or at least I thought it was a problem) I forgot to
free a couple of pointers. So in effect your answer
allowed to focus on the only real problem, the leaks,
and it's all been taken care of now :)

> P.S. Style preference: since you use MemHandleLock()
> to obtain the handle, I
> prefer using MemHandleUnlock() to unlock it.  Since
> you still have the
> handle, there's no need to use MemPtrUnlock(). 
> MemHandleLock /
> MemHandleUnlock give a nice symmetry.

There was a brief discussion in this forum about that
a couple of weeks ago; it turns out MemPtrUnlock() is
a little faster than MemHandleUnlock(), so that's why
I use that form. It's not quite intuitive, but since
it's more efficient I've gotten myself used to it.

Thanks again, your reply made all the difference!
Michel.P


--- Jeff Wheeler <[EMAIL PROTECTED]> wrote:
> You're right to be suspicious of your call to
> MemHandleFree(). You shouldn't
> call it on a handle received from DmQueryRecord().
> 
> DmQueryRecord() returns a MemHandle for a record
> that already exists in your
> database.  It returns the handle that was originally
> obtained by
> DmNewRecord() (or some other means of putting the
> data in the database).  It
> does NOT return a copy of the record in your dynamic
> memory, therefore you
> should NOT delete the handle with MemHandleFree(),
> which frees dynamic
> memory.
> 
> I think this explains your "free handle" error.  By
> using the dynamic memory
> free function on memory that is allocated in data
> manager memory, you've
> corrupted dynamic memory or your database.
> 
> You're still left with trying to find your memory
> leak...
> 
> Jeff

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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

Reply via email to