Hi
After calling 'MemHandleUnlock' you should not access that pointer
(myPtr[i]).
You can lock all records at the begining of your application and unlock them
at the end, but this is not recommanded since is can cause a major memory
fragmentation.

Dan Hod
The PalmMate Team

Gotta Palm? Gotta visit www.PalmMate.com

-----Original Message-----
From: Philip Ho <[EMAIL PROTECTED]>
To: Palm Developer <[EMAIL PROTECTED]>
Date: ��� ����� 09 ���� 1999 11:20
Subject: Any danger in my program?


>Dear all,
>
>I am not sure about the danger of my program, could anyone please help
>me?
>
>Suppose,
>// dbRef is the database with 100 records, each of size 15k
>for (i=0;i<100;i++)
>    {
>    recordH=DmQueryRecord(dbRef,i);
>    recordPtr=MemHandleLock(recordH);
>    myPtr[i]=(CharPtr)recordPtr;
>    MemHandleUnlock(recordH);
>    }
>
>Is it very unsafe to access myPtr after this FOR loop? Is the answer of
>this question depends on whether I would have to create new record or
>increasing the size of record after this FOR loop? OR, is the answer of
>the question depends on whether I have plenty of free storage heap
>memory or not?
>
>I think I would just leave MemHandleUnlock to happen when I exit my
>application. Am I correct?
>
>Thank you very much!
>
>philip
>
>
>
>

Reply via email to