Android Question Application exits unexpectedly - where to look for problems?

almontgreen

Active Member
Licensed User
Longtime User
I'm working on an application that loads a bunch of jpegs into cache and then clear cache and load more jpegs and so on. I'm using Cache version 1.36 library. I'm using SetApplicationAttribute(android:largeHeap,"True") in the Manifest Editor

I understand that using Cache.ClearMemoryCache might not run the garbage collector immediately and so I call it a couple of times with a DoEvents right after.

I reuse the same variable (in my app an array) when calling Cache.PutBitmapInMemory and I display it using a canvas object like this: Canvas1.DrawBitmap(Bitmp(1), Null, DestRect) followed by Activity.Invalidate and a DoEvents.

I check if the bitmap is in memory and if memory is used up to prevent loading too many jpegs. I've found I can load about 92 jpegs at 1280x720 resolution and still have some memory left.

The images seem to load ok into memory (the app doesn't exit during this sub). But any event, like pressing a mouse button or keypress seems to trigger an application exit.

It doesn't always happen in the same place - and there isn't any smoking gun I can find. However, doing a reboot seems to allow things to work longer before the app exits.

Does anyone have some suggestions on where to look for the problem? It kind of feels like there is some memory issue at work (and it is frustrating to have 2 gigs of ram and only be able to use about 1/2 a gig). It is really getting perplexing as each time the application exit happens at a different place.

Did anyone come up with a way to force the garbage collector? Are there issues with the Cache library I should be aware of?

Thanks!

By the way, I'm developing for miniPC only and the app only will be distributed on this device. No screen rotation issues or anything like that are at play.
 

almontgreen

Active Member
Licensed User
Longtime User
Ok, here is something interesting!
I was using a mouse left pressed event to trigger a sub to load images. When I eliminated that as the trigger to manage the images, the problem with the application exiting stopped. Hmm. Isn't that interesting?
 
Upvote 0

almontgreen

Active Member
Licensed User
Longtime User
Have you checked the logs? What is the error message?
No error message. The application exits silently upon pressing the left mouse button at a random point in the image loading sub. When using keyboard presses, the app runs without exiting (now been running for 24 hours). My best guess is there is something up with the firmware since the middle mouse button never even triggers an event.
 
Upvote 0
Top