I don't think it is just a memory leak. A memory leak usually fails
silently on the h/w device, and only become obvious on the desktop
sim/emulator (at least until you have leaked enough times that you cause
a crash). Certainly there IS a leak that needs to be cleaned up, if the
emulator is saying so, but that is housekeeping; a 'minor' problem.
The "free ptr" and "ptr is handle" errors indicate that memory pointers
are not being handled correctly in a couple of places at least, and
those REALLY need to be cleaned up, as they WILL crash the device.
These crashes would likely happen as the app runs. My guess is that the
app has also overwritten the bounds of a memory allocation somewhere,
corrupting something else (in another program), and that causes the
error upon exit.
If you don't know where to look, then my suggestion would be to comment
out large blocks of code until the app becomes stable. Try commenting
out almost everything at first, so that the app simply starts then
stops, to see if whatever initial allocations (probably in
'ApplicationStart/Stop' functions) are made and cleaned up correctly.
Then reactivate forms and functions gradually until the error happens,
and track the bugs down that way.
Bob
This is simply a memory leak. The problem is not always easy to find.
Somewhere in your code you are allocating memory (either with some type of
MemPtrNew, or with a API call that returns a allocated pointer). The error
only shows up when you exit the app since the program can only see such a
problem when you are closing it out. My advice is find out the address of
the memory that is causing the error (should be shown in the error box) and
see if you can locate what variable this is. This can be hard to do in some
cases since a given vairable doesnt always allocate the same memory in the
same location. I have found it best to try to recreate this error a few
times in a simulator and see if you can get the same memory location each
time. This would be done by running your app in the same way from a hard
reset of the simulator. if you can lock down a memory location, then you
can search for that address in your allocated vairables while running the
app. If this is not working, the next step is go through your code and find
every place you allocate memory (a large pain if its a large app). Then
make sure each allocated memory chunk is getting deallocated. In the end,
there is no easy way to simply pin point the problem variable that is
leaving allocated memory, since the app only checks for this on application
exit. Ive run into this problem many times, and it can be very frustrating
to fix it. hope this helps you out.
-- Scott Erickson Software Engineer, FB-4, Inc. [EMAIL PROTECTED]
"Evan Ovadia" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hey everyone. I'm getting a very strange error...
Yesterday, I was exiting my program and up came this fatal alert, with a
bunch of numbers. I had no idea what it means. I eventually found out that
it happened after my PilotMain ended. I know this because right before the
return statement I put a little flag there.
My first thought was that maybe it was a destructor. Well, it couldn't
have been any global object because I have no globals. And I looked for
objects local to PilotMain but there weren't any. Just to be sure, I
surrounded the contents of PilotMain in an artificial block. Still got the
error after PilotMain.
So there's only one possibility, as I see it. Palm OS is trying to do
something after I exit, maybe its trying to free something that was
allocated? Maybe its trying to free something that I already freed before,
im not sure. I searched high and low for something like this but nothing
was found.
So my question is: What does palm os do after I exit the program? What
does it try to wrap up? Is there something I'm doing wrong?
A little more information about the bug... I ran it in the simulator and
got "free ptr", and then "minor error while exiting app, unfreed chunk,
size 320" or something along those lines. Someone on these forums said to
try a hard reset, so I did. I ran it on my device again and then "ptr is
handle" showed up, instead of all those numbers.
Yeah, I'm totally lost O.o
Thank you all for your help. I really appreciate it!
-- For information on using the PalmSource Developer Forums, or to
unsubscribe, please see http://www.palmos.com/dev/support/forums/
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/