Here is how. I put some calls to MemHeapFreeBytes in PilotMain. One before
my app starts and one after it exits. Then compare the two results. I think
I got the code from Andrew Howlett's web site. [EMAIL PROTECTED]
If anyone can tell me how to get the writes-to-low-memory message to work,
I'd be grateful. I get a DISP16 Crc16CalBlock message when I compile.
DWord PilotMain (Word launchCode, Ptr cmdPBP, Word launchFlags)
{
Err err, error;
Word crc;
DWord startFreeDynamicMemory, endFreeDynamicMemory, junk;
#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL
MemHeapFreeBytes(0, &startFreeDynamicMemory, &junk); // <- this
remembers how much free memory before my app starts
#endif
#if ERROR_CHECK_LEVEL == CHECK_FULL
;//Word crc = Crc16CalBlock (NULL, 256, 0);
#endif
// Check ROM version
error = RomVersionCompatible (ourMinVersion, launchFlags);
if (error) return (error);
if (launchCode == sysAppLaunchCmdNormalLaunch)
{
if ((err = StartApplication()) == 0 )
{
EventLoop();
StopApplication();
}
}
#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL
;// ErrNonFatalDisplayIf (crc !=Crc16CalBlock(NULL, 256, 0), "low
Memory Trashed)");
#endif
#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL
MemHeapFreeBytes(0, &endFreeDynamicMemory, &junk); // // <- this sees
how much free memory after my app stops
ErrNonFatalDisplayIf (startFreeDynamicMemory != endFreeDynamicMemory,
"Memory Leak Occurred");
#endif
return (err);
}
> -----Original Message-----
> From: Michael S. Davis [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, May 04, 1999 9:41 PM
> To: Fawcett, Mitch
> Subject: Re: Memory leak test & menus
>
>
> How do you get the memory leak option available. On POSE debug options
> it is grayed out.
>
>
> On Tue, 4 May 1999, Fawcett, Mitch wrote:
>
> > I've gotten my first "real" finished application to pass the million
> gremlin
> > mark. It also passes the memory leak test except in one circumstance I
> know
> > of. If I have any of my dropdown menus showing and then tap one of the
> > built-in application keys to exit my program, the memory leak code in my
> > PilotMain function will say I have a leak. Can anyone explain what's
> going
> > on? and do I need to worry about it?
> >
> >
>
> ----------------------------------------------------
> Shoot-to-Win
>
> Protect the 2nd Amendment
> ----------------------------------------------------