FrmAlert causing a memory leak?
During a lengthy drawing operation, I allow the user to abort this drawing tapping on the screen. I detect this action with an occasional check to EvtSysEventAvail( true ). When I detect this, I ask user confirmation with a FrmAlert. Alas, POSE reports 2 memory leaks under OS 3.5 or 4.1. The log indicates this twice (40 and 682 bytes): 29889.839: Relocatable chunk leaked at 0x61A6, size = 40 29889.839: Chunk allocated by: 29889.839: WinCreateBitmapWindow 29889.839: WinCreateOffscreenWindow 29889.839: WinSaveBits 29889.839: 29889.839: 29889.839: PrvSendEventToForm 29889.839: PrvRedrawDisplay 29889.839: FrmEraseForm 29889.839: FrmDoDialog 29889.839: FrmCustomAlert 29889.839: FrmAlert 29889.839: 29889.839: 29889.839: 29889.839: PrvSendEventToForm Is FrmAlert realy causing these memory leaks? How can I avoid this? -- Luc Le Blanc -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: FrmAlert causing a memory leak?
Luc Le Blanc wrote: During a lengthy drawing operation, I allow the user to abort this drawing tapping on the screen. I detect this action with an occasional check to EvtSysEventAvail( true ). When I detect this, I ask user confirmation with a FrmAlert. Alas, POSE reports 2 memory leaks under OS 3.5 or 4.1. The log indicates this twice (40 and 682 bytes): 29889.839: Relocatable chunk leaked at 0x61A6, size = 40 29889.839: Chunk allocated by: 29889.839: WinCreateBitmapWindow 29889.839: WinCreateOffscreenWindow 29889.839: WinSaveBits 29889.839: 29889.839: 29889.839: PrvSendEventToForm 29889.839: PrvRedrawDisplay 29889.839: FrmEraseForm 29889.839: FrmDoDialog 29889.839: FrmCustomAlert 29889.839: FrmAlert 29889.839: 29889.839: 29889.839: 29889.839: PrvSendEventToForm Is FrmAlert realy causing these memory leaks? How can I avoid this? Just a stab in the dark, but when the alert closes, it's going to cause your form to redraw, which means you're going to get a frmUpdateEvent. I wonder if perhaps your code is getting nested frmUpdateEvents and is unable to handle one while it's already in the process of drawing. Do you call WinSaveBits() anywhere in your own form-drawing code? As I said, just an idea, but it seems possible that PrvSendEventToForm() is being called after they dismiss the alert, and it's sending an update event to your form event handler, which shows up as one of the unknown symboles (between PrvSendEventToForm() and WinSaveBits()). Which reminds me: have you tried running this same thing with a debug build? If those functions are your own, that should give you the missing symbols in the stack backtrace. - Logan -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: FrmAlert causing a memory leak?
Logan Shaw wrote: Luc Le Blanc wrote: During a lengthy drawing operation, I allow the user to abort this drawing tapping on the screen. I detect this action with an occasional check to EvtSysEventAvail( true ). When I detect this, I ask user confirmation with a FrmAlert. Alas, POSE reports 2 memory leaks under OS 3.5 or 4.1. The log indicates this twice (40 and 682 bytes): 29889.839: Relocatable chunk leaked at 0x61A6, size = 40 29889.839: Chunk allocated by: 29889.839: WinCreateBitmapWindow 29889.839: WinCreateOffscreenWindow 29889.839: WinSaveBits 29889.839: 29889.839: 29889.839: PrvSendEventToForm 29889.839: PrvRedrawDisplay 29889.839: FrmEraseForm 29889.839: FrmDoDialog 29889.839: FrmCustomAlert 29889.839: FrmAlert 29889.839: 29889.839: 29889.839: 29889.839: PrvSendEventToForm Is FrmAlert realy causing these memory leaks? How can I avoid this? Just a stab in the dark, but when the alert closes, it's going to cause your form to redraw, which means you're going to get a frmUpdateEvent. I wonder if perhaps your code is getting nested frmUpdateEvents and is unable to handle one while it's already in the process of drawing. You're right. And I note this new frmUpdateEvent gets handled right away, even before I finish handling the first one. But I still can't figure why the flag I clear before drawing gets somehow set before this new event gets processed. The purpose of this flag is precisely to ignore such nested events. You definitely put me on the right trail. Do you call WinSaveBits() anywhere in your own form-drawing code? Yes. To save the map data that lies underneath the toggable scale. As I said, just an idea, but it seems possible that PrvSendEventToForm() is being called after they dismiss the alert, and it's sending an update event to your form event handler, which shows up as one of the unknown symboles (between PrvSendEventToForm() and WinSaveBits()). Which reminds me: have you tried running this same thing with a debug build? If those functions are your own, that should give you the missing symbols in the stack backtrace. I am running this in the CW 9.3 debugger with a debug ROM in POSE. -- Luc Le Blanc -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/