From: "Barnett, Phil R" <[EMAIL PROTECTED]>
> Ok, thanks for the feedback on my data read routine. This is my data
> create routine. I have a memory leak somewhere and I'm suspecting my
> table handling routines. (for a reason that I'll ask about later in an
> unrelated problem, I can't run a debug rom.)
>
One way to track this sort of problem is to write a simple
debug wrapper for the memory functions.  It's a bit of work,
but is a reusable framework that can be applied to other
projects.

The basic idea is that you create functions called DebugMemPtrNew, 
DebugMemHandleFree, etc that have exactly the same 
prototypes as the standard mem calls.  Your functions note 
details about the mem action and then call the appropriate 
memory function.

My functions wrote comma separated strings to a db so that 
I could just backup the database and then dump the strings into 
Access for analysis, you can use whatever works for you.  You 
want to be able to match allocs and free, locks and unlocks and 
have some idea of what's in the memory or where it was allocated.

Then use something like #define MemHandleNew DebugMemHandleNew
to insert your calls in place of every system call.

As I said, it's not trivial, but you'll only write it once.  I have 
a vague memory of posting some fairly complicated code to 
do this to the forum some time ago but in some ways it's
better to write it yourself so that you understand what it's
doing.

Chris Tutty

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

Reply via email to