Hi,
Thanks for the responses!
Below is actually how I started out and had the same results.
if (addToList)
{
UInt32 len = StrLen(packBuffer);
MemHandle packH = MemHandleNew(len + 1);
Char* packP = (Char*)MemHandleLock(packH);
MemMove(packP, packBuffer, len + 1);
gPackList[indexLst] = (Char*)packP;
indexLst++;
MemHandleUnlock(packH);
packH = 0;
}
It actually runs on all the Palms(PalmIII, Zire, m505, Zire 71, Zire 72)
that I have tested it on. However, it always gives the "unlocked chunk of
memory" error when I use the emulator. It is my understanding the emulator
is more sensitive to memory errors and is a great diagnostic tool. Should I
trust the emulator's diagnosis? Any other ideas?
Best Regards,
Chris Engler
"Jan Slodicka" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> lifetime of the packP variable is among the lock/unlock calls. However,
> you
> use it thereafter.
>
> Best regards,
> Jan Slodicka
>
> ----- Original Message -----
> From: "Chris Engler" <[EMAIL PROTECTED]>
> Newsgroups: palm-dev-forum
> To: "Palm Developer Forum" <[email protected]>
> Sent: Friday, May 27, 2005 8:05 AM
> Subject: "unlocked chunk of memory" error
>
>
>> I am using the code below to create a list. However it keeps giving me
>> an
>> "unlocked chunk of memory" error. I have tried several different
>> arrangements using StrCopy and MemMove but I continue to get this error.
> I
>> must be overlooking something. Please, someone offer me some
>> suggestions.
>> Thank you!
>>
>> Char ** gPackList = 0;
>> Char packBuffer[21] = "";
>> Boolean addToList = true;
>>
>> some code...
>>
>> case frmOpenEvent:
>> gPackList = (Char **) MemPtrNew(packListSize * sizeof(Char*));
>>
>> some code...
>>
>> if (addToList)
>> {
>> UInt32 len = StrLen(packBuffer);
>> MemHandle packH = MemHandleNew(len + 1);
>> Char* packP = (Char*)MemHandleLock(packH);
>> MemMove(packP, packBuffer, len + 1);
>> MemHandleUnlock(packH);
>> packH = 0;
>> gPackList[indexLst] = (Char*)packP;
>> indexLst++;
>> }
>>
>> some code...
>>
>> Best Regards,
>>
>> Chris Engler
>>
>>
>>
>> --
>> For information on using the PalmSource Developer Forums, or to
> unsubscribe, please see http://www.palmos.com/dev/support/forums/
>
>
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/