> What is going on?

It's not exactly clear from your incomplete example.  But if "tempBody" is of
type "myHeader", then you're copying "sizeof(myHeader) + 3" bytes of data into a
memory chunk that's "sizeof(myHeader) + 2" bytes long.  Thus, you're overwriting
the end of the block, and possibly the lockcount information of the subsequent
block.

The Palm OS Emulator catches this kind of error...

-- Keith Rollin
-- Palm OS Emulator engineer






Craig Allan Jeffree <[EMAIL PROTECTED]> on 08/04/2000 12:53:12 AM

Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>

Sent by:  Craig Allan Jeffree <[EMAIL PROTECTED]>


To:   "Palm Developer Forum" <[EMAIL PROTECTED]>
cc:    (Keith Rollin/US/PALM)
Subject:  Wacky MemHandles



Hi all,
I am having difficulties with a few mem handles.  I have declared them,
initialised them for the correct amount of memory.  I then lock them.
They each are independant of one another.   However, when I unlock them
after I have performed a couple of MemMoves into the memory space of the

MemHandles, it gives me a message of chunk underlocked.
 I tested each of the memhandles to be non 0, and I tested each of the
pointers generated to be non 0.  What is going on?

Thanks.

Here's a snippet of the code:


 Frag32 = MemHandleNew((UInt32)(sizeof(myHeader) + 2));

   tempBody.IP_Packet_ID = 2;
   tempBody.Segment_ID = 1;
   packet_type = IP_PACKET;
   tempPtr = (UInt8 *)MemHandleLock(Frag32);
   MemMove(tempPtr, &packet_type, 1);
   MemMove(tempPtr+1, &tempBody, sizeof(tempBody));
   MemMove(tempPtr + 1 + sizeof(tempBody), &Fragments3_2[0], 2); /*
UInt8 array declared earlier*/
   MemHandleUnlock(Frag32);


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





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

Reply via email to