> -----Original Message-----
> From: Jason Simpkins [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 13, 2000 8:07 PM
> To: Palm Developer Forum
> Subject: Chunk under-locked
> 
> 
> Chunk under-locked
> 
> For some reason I keep getting this error message, and for 
> the life of me
> can't figure out why.
> This usally happens when I exit my applications.

Jason, you get "Chunk under-locked" when a chunk's lock count is decremented
more than it should be.  Here's a trivial and silly example that should
cause the exact same message:

VoidHand hChunk = MemHandleNew(sizeof(Long));
MemHandleLock( hChunk );        // lock count 1
MemHandleLock( hChunk );        // lock count 2
MemHandleUnlock( hChunk );      // lock count 1
MemHandleUnlock( hChunk );      // lock count 0
MemHandleUnlock( hChunk );      // Chunk under-locked!

Somewhere, you are causing an under-lock to happen.  You can try using the
undocumented (unsupported?) API:
UInt            MemHandleLockCount(VoidHand h)

to aid in debugging.

> 
> Another error message happens when I switch forms, I get a:
> 
> <name here> has just read from an un-allocated chunk of memory.

Hmm, double-check any fields your form is using.  Are you
MemHandleFree()-ing or MemHandleUnlock()-ing a field's text handle?  If so,
you must subsequently set the field's text handle to zero, otherwise the OS
will think it's a valid handle and attempt to free it (boom!).  The OS will
attempt to do this as part of the frmClose, so check out the code for the
form that was on the scren -before- you switched to another form.

For more on this field handle stuff, check out
http://oasis.palm.com/devzone/knowledgebasearticle.cfm?article_id=1051

If you're using any database-allocated (storage heap) chunks, make sure your
lock/unlockings are balanced too.

Good luck,
-Jeff Ishaq
Vanteon (formerly The Windward Group)

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to