I'm in the process of creating an application in which all Forms and Form
Objects are created dynamically using FrmNewForm and FrmNewXXX calls. I'm
running into crashes on OS 5 upon the deletion and creation of Dynamic Form
Objects within Dynamic Forms.

The problems appear to be confined to OS 5. I can run the code against debug
ROM's on the OS 4.x emulator with no issues at all. 

On OS 5 simulation the crashes occur and crash the simulator application
completely leaving no useful debugging information. This left me to theorize
about the source of the crashes. One likely possibility seems that the Forms
are being moved around in memory throughout the usage of the application. In
order to correct this I added FrmGetFormPtr and FrmValidatePtr calls to
check the Form Pointer before attempting to delete the Form Objects
contained within the Forms. 

As a way of confirming that I had FrmGetFormPtr calls in the right places I
included a call to MemSetDebugMode(memDebugModeScrambleOnChange). When run
on the Emulator with this debug mode the Emulator was able to pick up the
errors which I think are crashing OS 5. FrmNewGadget will crash when called
against a FormPP (that was validated immediately beforehand) with an
"odd-numbered read" memory error.

I have a few questions here:
*Is there another possible explanation for these OS 5 crashes? Currently I'm
assuming that OS 5 does much more active and frequent movement of Forms in
memory than happens on OS 4. (Even in the time between validating a FormPtr
and using it.) 
*If my theory about Forms moving in memory is correct is there any way to
limit this or lock them down in such a way as to prevent this problem. (I've
tried calling MemHeapCompact on the dynamic heap prior to getting the
FormPtr's)
*Any suggestions on how to better debug these errors on the Simulator? The
latest Garnet Simulator also crashes fatally with these problems.

Any ideas appreciated,

Glenn Keighley

[EMAIL PROTECTED]
http://www.epocrates.com



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

Reply via email to