It's possible that the error is outside the code snippet you posted. Do you actually lock the memory anywhere, for instance?
Personally, I've always tried to avoid using the memory resizing functions - it tends to lead to memory fragmentation on most platforms... Can't you use a linked list or something? On this platform (in my application) I'm using memory resizing in only one place - and I resize a memory handle; not a pointer. That is, something like this: MemHandle h; UInt8 *buffer; h = MemHandleNew (BUFSIZE); buffer = (UInt8 *) MemPtrLock (h); : MemHandleResize (h, newsize); : MemHandleUnlock (h); MemHandleFree (h); and it works without problems - but I don't know how well this translates to your particular needs. Also, I'm not sure that "memory chunk" refers to something pointed by any random pointer. I have the nagging feeling that it refers to something pointed by a memory handle. At least when I used DmCreateDatabaseFromImage (which takes a pointer to a locked memory chunk, according to the docs), it didn't work when I was passing it a pointer allocated with MemPtrNew to it - but it worked when I passed it a pointer the result of MemPtrLock (MemHandleNew ()). Although it could be that it didn't work because I couldn't lock the memory - there is no MemPtrLock function, although there is a MemPtrUnlock. Regards, Vesselin -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
