Hi, I remember that there was a discussion on how to find memory leak.  I am
sorry I can't remember the name of the person who wrote the good article
about it, but I have read it and have some questions.

I use the code shown below to detect a memory leak. In the FMainForm, my
program basically do nothing except waiting for the user to press a button.
but even I just start the app and then exit immediately, I get a memory leak
detect.  Am I using the right method to detect it?  And using the debug
console, I get a line with:
start           handle          localID         size            size    lck     own    
 flags
*00004158       00001848        00001849        000388          000390  #2       #1    
 fM

Does this line really mean a leak?

Thanks for your help in advance.

Jacky


UInt32 PilotMain(UInt16 cmd, void *cmdPBP, UInt16 launchFlags)
{
  UInt16 error;
  UInt32 startFreeBytes, endFreeBytes;
  UInt32 junk;

  if(cmd == sysAppLaunchCmdNormalLaunch)
  {
    // check to make sure that the palm has the correct version of the OS
    error = RomVersionCompatible (minVersion, launchFlags);
    if(error)
        return error;

        MemHeapFreeBytes(0, &startFreeBytes, &junk);

        // Initialize the application's global variables and database.
        if(StartApplication())
        {
                FrmGotoForm(FMainForm);
                EventLoop();
                StopApplication();
        }
        MemHeapFreeBytes(0,&endFreeBytes,&junk);
         ErrFatalDisplayIf(startFreeBytes!=endFreeBytes, "Memory leak");
 }

  return 0;
}





-- 
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