| Issue 2366: | RenderScript used to draw text shadow causes thread leak on Android 4.2.2 | |
| 2 people starred this issue and may be notified of changes. | Back to list |
Affected Version: Android 4.2.2 What steps will reproduce the problem? 1. Drag any app widget on the launcher (ex. "Settings"). 2. Hit the app widget to launch the app. 3. Hit home button to get back to the launcher. 4. Repeat step 2 and 3. What is the expected output? What do you see instead? Use console command "adb shell ps -t | findstr launcher", you will find thread leak in the launcher process. Those worker threads should be destroyed after the FontRenderer is destroyed. Root cause: The method FontRenderer::blurImage (in frameworks\base\libs\hwui\FontRenderer.cpp) will use its member mRs (class of RSC::RS) to handle the computation of text shadow. RSC::RS has strong pointer members U8, A_8, and U8_4 (in frameworks\rs\cpp\rsCppStructs.h) which reference back to RSC::RS by strong pointer. These cross-references cause RSC::RS can't be destoryed. So during the launching app and going back to the launcher operation FontRenderer is created and then destroyed. Its member RSC::RS is only created but never be destroyed and causing the thread-leak. Android 4.2 doesn't have this problem since it uses ordinary pointer to handle members like U8, A_8, U8_4. Special note: I modified the file frameworks\base\libs\hwui\Caches.cpp to make reproducing this bug easier: In "void Caches::flush(FlushMode mode)" method, move code "dropShadowCache.clear()" and "fontRenderer->clear()" from "case kFlushMode_Full:" to "case kFlushMode_Layers:". Please note this modification is NOT required to reproduce the bug. It only makes reproducing easier. The root cause is the strong pointer cross-reference.
Dec 25, 2013
#1
henry.uh...@gmail.com
Dec 25, 2013
Please ignore this thread. This issue belongs to AOSP.
Dec 27, 2013
(No comment was entered for this change.)
Status:
Invalid
|
|
| ► Sign in to add a comment |