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