hello group:
I was trying to implement the recycle method for a
class that we use a lot in the company that I work for. The thing is
that for what I read in some posts, it was a good practice to recycle
the bitmaps that were no longer needed and since I dont know where
that could happen in every program I decided to execute the recycle
method in the finalize method that executes the class that holds the
reference to the bitmap.
The thing is that my application is destroyed after
the GC is executed. At first I thought that the recycle call caused
the problem but I wrap it with a try / catch / Throwable and the
problem remained. I also debugged my application trying to see if
actually the recycle method was causing the problem but everytime the
recycle was executed, it did without problems, and afterwards the
application crashed.
Here is the finalize method
@Override
protected void finalize() throws Throwable {
// TODO Auto-generated method stub
super.finalize();
System.out.println("FINALIZING!!!!!!!!!!!!!!!!!");
try{
if(mBitmap!=null && !mBitmap.isRecycled()){
Thread.sleep(3000);
mBitmap.recycle();
}
}catch(Throwable e){
System.out.println(e.getMessage());
e.printStackTrace();
}
}
and here is the logcat output.
Ill apreciate it any help you can give me. Thanks in advance.
Claudio Veas
PS: Oh just not to have problems at work I replace the real package
name with <package name>
01-15 11:24:24.661: INFO/System.out(322): FINALIZING!!!!!!!!!!!!!!!!!
01-15 11:24:26.989: INFO/System.out(322): >>>>>>>>>>>init
text_array<<<<<<<<<<<<<<<<<
01-15 11:24:27.000: INFO/System.out(322): >>>>>>>>>>>nb_str = 444
01-15 11:24:27.279: INFO/System.out(322):
>>>>>>>>>>>>>>3D<<<<<<<<<<<<<<<
01-15 11:24:27.780: INFO/DEBUG(20): *** *** *** *** *** *** *** ***
*** *** *** *** *** *** *** ***
01-15 11:24:27.790: INFO/DEBUG(20): Build fingerprint: 'generic/
generic/generic/:1.0/110632/110632:sdk/test-keys'
01-15 11:24:27.810: INFO/DEBUG(20): pid: 322, tid: 323 >>> <package
name> <<<
01-15 11:24:27.810: INFO/DEBUG(20): signal 11 (SIGSEGV), fault addr
00000498
01-15 11:24:27.831: INFO/DEBUG(20): r0 00000498 r1 00000000 r2
00000498 r3 4100afbc
01-15 11:24:27.841: INFO/DEBUG(20): r4 00000498 r5 001e3cb0 r6
00000000 r7 4100af98
01-15 11:24:27.851: INFO/DEBUG(20): r8 100ffcf8 r9 4100af90 10
4100af80 fp 00000001
01-15 11:24:27.851: INFO/DEBUG(20): ip ac12648c sp 100ffcb8 lr
ac046400 pc afb044e4 cpsr 20000010
01-15 11:24:28.000: INFO/DEBUG(20): #00 pc afb044e4 /system/
lib/libcutils.so
01-15 11:24:28.000: INFO/DEBUG(20): #01 lr ac046400 /system/
lib/libsgl.so
01-15 11:24:28.020: INFO/DEBUG(20): stack:
01-15 11:24:28.020: INFO/DEBUG(20): 100ffc78 ffffff92
01-15 11:24:28.040: INFO/DEBUG(20): 100ffc7c afe0dd48 /system/
lib/libc.so
01-15 11:24:28.061: INFO/DEBUG(20): 100ffc80 ffffff92
01-15 11:24:28.070: INFO/DEBUG(20): 100ffc84 100ffca0
01-15 11:24:28.070: INFO/DEBUG(20): 100ffc88 0000aadc [heap]
01-15 11:24:28.080: INFO/DEBUG(20): 100ffc8c 0000aad8 [heap]
01-15 11:24:28.090: INFO/DEBUG(20): 100ffc90 00003071
01-15 11:24:28.100: INFO/DEBUG(20): 100ffc94 0003fd80 [heap]
01-15 11:24:28.100: INFO/DEBUG(20): 100ffc98 4100af58
01-15 11:24:28.100: INFO/DEBUG(20): 100ffc9c afe0e410 /system/
lib/libc.so
01-15 11:24:28.100: INFO/DEBUG(20): 100ffca0 0003fd80 [heap]
01-15 11:24:28.109: INFO/DEBUG(20): 100ffca4 00000001
01-15 11:24:28.131: INFO/DEBUG(20): 100ffca8 00000002
01-15 11:24:28.149: INFO/DEBUG(20): 100ffcac ad0471bd /system/
lib/libdvm.so
01-15 11:24:28.178: INFO/DEBUG(20): 100ffcb0 df002777
01-15 11:24:28.190: INFO/DEBUG(20): 100ffcb4 e3a070ad
01-15 11:24:28.199: INFO/DEBUG(20): #00 100ffcb8 00000498
01-15 11:24:28.199: INFO/DEBUG(20): 100ffcbc ac046400 /system/
lib/libsgl.so
01-15 11:24:28.199: INFO/DEBUG(20): 100ffcc0 00000028
01-15 11:24:28.199: INFO/DEBUG(20): 100ffcc4 00000000
01-15 11:24:28.199: INFO/DEBUG(20): 100ffcc8 001e3cb0 [heap]
01-15 11:24:28.199: INFO/DEBUG(20): 100ffccc ac046c54 /system/
lib/libsgl.so
01-15 11:24:28.199: INFO/DEBUG(20): 100ffcd0 00000000
01-15 11:24:28.199: INFO/DEBUG(20): 100ffcd4 001e3cb0 [heap]
01-15 11:24:28.199: INFO/DEBUG(20): 100ffcd8 00000000
01-15 11:24:28.199: INFO/DEBUG(20): 100ffcdc ac046d08 /system/
lib/libsgl.so
01-15 11:24:28.199: INFO/DEBUG(20): 100ffce0 100ffd18
01-15 11:24:28.199: INFO/DEBUG(20): 100ffce4 00000000
01-15 11:24:28.199: INFO/DEBUG(20): 100ffce8 ad339c85 /system/
lib/libandroid_runtime.so
01-15 11:24:28.199: INFO/DEBUG(20): 100ffcec ad339c93 /system/
lib/libandroid_runtime.so
01-15 11:24:28.199: INFO/DEBUG(20): 100ffcf0 4001dbf8
01-15 11:24:28.199: INFO/DEBUG(20): 100ffcf4 ad00d9f8 /system/
lib/libdvm.so
01-15 11:24:28.199: INFO/DEBUG(20): 100ffcf8 41088ba8
01-15 11:24:28.199: INFO/DEBUG(20): 100ffcfc 0003fd80 [heap]
01-15 11:24:29.080: INFO/ActivityManager(51): Process <package name>
(pid 322) has died.
01-15 11:24:29.100: INFO/WindowManager(51): WIN DEATH: Window
{434a34d0 <package name>/ <package name>.<main activity name>}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---