Thanks for your detailed answer, I'm getting closer.

where can I get more info on how to interpret all these codes that show up
on the console window when a command is executed. in other word how can read
this hexa language?

thanks again,
Flora

> -----Original Message-----
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> Sent: Saturday, May 05, 2001 4:51 AM
> To:   Flora_Mahdavi
> Subject:      Re: 'hd 0'
> 
> Hi Flora,
> 
>    Regarding your problem with fatal alert and 'hd 0' command, the 
> fatal error happens when there is a memory leak in your program. Like 
> an allocated memory is not released when your application closes. 
>    Just in case you aren't doing it yet, make sure you are calling
> FrmCloseAllForms() in your AppStop(). 
>    The warning message suggests to use "hd 0" to track down the 
> leak.  Try doing that - use the Console window in the CodeWarrior 
> debugger, or in the PalmDebugger application.  That'll show you what 
> has been allocated.  You can then hopefully figure out what object it 
> was that you didn't clean up, by looking at its contents.
>    Lets say you debug when your program exits and you see the memory 
> leak dialog.
> 
> Now, open the console and do a hd 0.
> 
> Look through the list for memory that belongs to your program.  These 
> chunks will usually have owner #2 and a star at the front of the 
> line.  Note that the CW debugger on Windows reverses the labels for 
> lock and owner -- the first number shown is the owner.
> 
> Say you have something that looks like
> 
>  start    handle   localID   size   size  lck own flags
> -------------------------------------------------------
> *000046D4 00001B9C 00001B9D 00000C 000014  #2  #1    fM
> 
> The first thing you can tell is that the block of memory starts at 
> 0x46D4.
> So, if you do "Data/View Memory" from CW, you can enter that hex 
> address and see the contents of the lost chunk.
> 
> The second thing to notice is the size.  Here, the chunk is 0xC bytes 
> == 12 bytes.  You can use that along with the contents to try to 
> guess where this memory was allocated by your program.
> 
> Here, the lock count is 1 -- that means the chunk was allocated with
> MemHandleNew and is locked.  If its #15, it was allocated by 
> MemPtrNew.
> 
> Finally, the handle is 0x1B9C -- that means the MemHandle variable 
> that goes with this would have the value 0x80001B9C.
> 
> This last bit is useful for debugging code in the middle of a 
> program.  If you've breaked somewhere and just have a handle that 
> isn't locked, you can do a "hd 0", find the handle, then use that to 
> get the address of the chunk that goes with the handle for viewing in 
> the memory window.  It would be nice to automate this, but that's 
> beyond the CW debugger for the time being.
> 
> Thanks,
>    Manikumar K
> ---------------------------------------------------------
> Developers' Nation
> You've got the questions; we've got the answers.
> http://www.devnation.net
> ---------------------------------------------------------
> 
> 
> 
> 
> --- In [EMAIL PROTECTED], Flora_Mahdavi <[EMAIL PROTECTED]> wrote:
> > In a fatal alert I get says:
> > 
> > Use the 'hd 0' command to find chunks owned by your app.
> > 
> > Does anybody know what it means and how I can use 'hd 0'?
> > 
> > thanks,
> > Flora
> > 
> > -- 
> > For information on using the Palm Developer Forums, or to 
> unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/

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