问题
I use RenderScript in my app to do several image processing tasks.
Sometimes, I randomly get the following exception:
10-10 15:27:04.479: E/AndroidRuntime(2113): FATAL EXCEPTION: FinalizerWatchdogDaemon
10-10 15:27:04.479: E/AndroidRuntime(2113): java.util.concurrent.TimeoutException: android.renderscript.Type.finalize() timed out after 10 seconds
10-10 15:27:04.479: E/AndroidRuntime(2113): at android.renderscript.RenderScript.nObjDestroy(RenderScript.java:216)
10-10 15:27:04.479: E/AndroidRuntime(2113): at android.renderscript.BaseObj.finalize(BaseObj.java:116)
10-10 15:27:04.479: E/AndroidRuntime(2113): at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:187)
10-10 15:27:04.479: E/AndroidRuntime(2113): at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:170)
10-10 15:27:04.479: E/AndroidRuntime(2113): at java.lang.Thread.run(Thread.java:856)
All my RenderScript-Calls are enclosed by a Semaphore to prevent that the same script is running parallel. Can anybody tell me what this message means and how I can prevent it?
回答1:
Do you have a very long running kernel?
This thread is attempting to cleanup RS objects when the GC removes the java code reference. If there is a very long running kernel it may be blocked long enough to trigger what you are seeing. We don't allow objects to be modified by an external thread while a kernel is running, so in effect that external thread is blocked until kernel completion.
来源:https://stackoverflow.com/questions/19300154/android-renderscript-finalizerwatchdogdaemon-fatal-exception