When chasing a problem like this a couple of years ago, my testing seemed to
indicate that setting a bitmap to null right after a call to recycle() was
leaky. It was as though the recycle call needed some time to work, and setting
null got in the way. I found it was better to just call recycle
Working with bitmaps is a little hard on Android.
One thing to do is to resize or pack them so that they take up less memory.
Another thing you may want to look into is to reuse the bitmap
object/memory. You may have to do this in native though.
As other have pointed out System.gc() just gives
Sorry for the large code. Thanks for your help. What I would like to
know is when to use weak references and if it is a good option while
using Bitmaps? If so how does it help?
/** This is the onPause function which releases the bitmap when the
imagebutton is clicked and gallery is displayed.
I realised that when when I made a call to System.gc() right after the
bitmao..recycle() call the heap space is getting returned to the VM
heap. But I have been reading about Garbage collection and it seems
that calling System.gc() is not a good programming practice. Is there
another way to make
You should work on getting a smaller example to demonstrate as this is too
much code to read through.
It may also help you solve the problem yourself.
On Dec 20, 2011 3:21 PM, shyama shyama.asoka...@gmail.com wrote:
I realised that when when I made a call to System.gc() right after the
A call to System.gc() doesn't actually start the GC process. All it does is
add the request to the queue. The operating system will then decide at its
leisure when to actually do the GC. So even calling System.gc() repeatedly
(as is sometimes recommended) is just another word for desperation.
6 matches
Mail list logo