I recently needed to debug some memory allocation and added the
following line to my program:


TraceOutput( TL( appErrorClass, "re-allocated %hu bytes of record
memory", gNumRecordsAllocated * sizeof(UInt16) ) );


When that spit out "re-allocated 0 bytes of record memory" I tried:


TraceOutput( TL( appErrorClass, "re-allocated %hu bytes of record
memory", UInt16(gNumRecordsAllocated * sizeof(UInt16)) ) );

When that also spit out "re-allocated 0 bytes of record memory" I
tried:

UInt16 BytesAlloc = gNumRecordsAllocated * sizeof(UInt16);
TraceOutput( TL( appErrorClass, "re-allocated %hu bytes of record
memory", BytesAlloc ) );


When that worked, I moved on.

Anyone have any thoughts on why I was getting "0" in the first two
cases?  I'm using the latest GCC toolchain with the 4.1 headers and
libs.
  Michael S. Harrison
  michaelh.dragonseye@com
  (reverse the dot and at to send email)

* The opinions expressed here are those of my iguana
* and I never know what he's going to say next.

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

Reply via email to