At 04:58 PM 5/29/2005, you wrote:
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?
You store packP in the gPackList, but that pointer value will be invalid as soon as MemHandleUnlock runs -- the pointer to a handle only is valid while the handle is locked. It would be better for you to store the handle values and have your code lock/unlock them as needed.
-- Ben Combee, Senior Software Engineer, palmOne, Inc. "Combee on Palm OS" weblog: http://palmos.combee.net/ Developer Forum Archives: http://news.palmos.com/read/all_forums/ -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
