application randomly? auto closing

  • Thread starter Thread starter keith
  • Start date Start date
K

keith

hey all
just wondering if anyone has every had written an app that would run
for a random period of time and then just completely dissapear (even
from memory)?
i'm sure it's something in my code, but i'll start my app and just let
it sit there and within 18-24 hours later it'll sometimes just
dissapear. I've got print statements to a log file within the
dispose() method, and closed, closing, and disposed events, yet nothing
gets written. also have catch statements around everything and print
statements within those, again nothing written. the general
environment of the app is 2 threads, the main one is the gui, and the
2nd one is a gprs connection connecting/disconnecting looking for
updates from a db server.

anyone has any clues please let me know, i appreciate it
thanks keith
 
Could it be that the device is running low on memory and hence closing your
app? Monitor the memory to see if that is the case...

Cheers
Daniel
 
Nope, there's 52mb free in storage, and 45mb free in Program. But is
there something possible that the os will shut down a foreign app if
it's not used for a while?
 
That was a pretty quick reply. When are you checking for the free memory?
Sure you have free memory when the app starts and after it has been closed
but how about *just* before it closes? If you have some kind of leak you can
tell by monitoring the memory throughout the app's lifetime.

If you leave another app running does it close too? Try it with 2 other apps
running at the same time, one native and one managed.

Also enable the perf counters and see if mscoree.stat gets created (if your
app crashes and exits, the file will not be created otherwise you'll have
some memory usage data).

Cheers
Daniel
 
Of course, I didn't even think of checking the memory just before it
closes (banging my head on the wall). I follow the idea, but I've no
knowledge of perf counters or mscoree.stat, any quick starters about
that would be great.
Thanks again, Keith
 
"Free memory" may not have anything to do with it. CE works a little
differently than the desktop. Can you put something in OnClose or use an
IMessageFilter to see if something is closing you?

-Chris
 
I ran into this problem when I had a return statement inside a catch
clause in my worker thread. The return statement was never called, but
when the thread ended the whole program would shut down. I took out
the return statement and everything works fine. My guess is it's
something with the compiler.
 
Back
Top