Greetings,
        I've been trying to track down some memory leaks
in some old code.  I was unable to find it (them?), so 
I decided to start with the stationary provided by 
CodeWarrior (R6, POSE 3.0.a7, PalmVRelease Rom) and 
add a memory leak on purpose so I could figure out 
how to find it.  Hah!   It turns out that the 3.1 
stationary leaks without me doing anything.  Ain't
that a pisser!

I visited the page: http://www.fifthgate.org/articles/palm_mem_leaks.html
and added: 
        
#ifdef DO_MEM_CHECK
        DWord startFreeDynamicMemory, endFreeDynamicMemory, junk, diff;
        Char *str;
        MemHeapFreeBytes(0, &startFreeDynamicMemory, &junk);
#endif
        err = StarterPilotMain(cmd, cmdPBP, launchFlags);
#ifdef DO_MEM_CHECK
        MemHeapFreeBytes(0, &endFreeDynamicMemory, &junk);
        diff = startFreeDynamicMemory - endFreeDynamicMemory;
        if ( diff > 0 ) {
                str = (Char*)MemPtrNew(45);
                StrPrintF( str, "Memory leak %lu ", diff );
                ErrDisplay( str );
        }
#endif

and it says that it leaked 106 bytes.  Which means, I think, that
there is something seriously wrong going on.  I checked, and 
there is no heap memory going on anywhere that I can see.  So,
I think that I'm screwed.  Should I subtract 106 bytes from any
memory leak that is reported to me?  Should I give up hope and 
decided not to bother trying to track down memory leaks (unless
they are really bad and cause the system to crash)?  

I'm coming from a Unix programming environment and I am 
incredibly frustrated with the tools that I have to use in this
environment.  I was so happy using gcc/gdb/emacs, they 
worked so nicely together, and they were free.  So, hopefully
I'm doing something wrong and this is just part of the learning
process.  Am I doing something wrong or does the equivalent 
of a 'hello, world' app leak? 

I'm pleased (relieved?) to report that the memory leak does not 
occur with the 3.5 stationary.

Clark

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