Release bitmaps from android.view.GLES20DisplayList

android, memory-leaks, out-of-memory

Solution

This seems to be a memory leak in 4.2. Looks like this fix is intended against it: https://android.googlesource.com/platform/frameworks/base/+/034de6b1ec561797a2422314e6ef03e3cd3e08e0

I disabled hardware acceleration in the manifest for 4.2 for the activity where I encountered this problem, this helped with android.view.GLES20DisplayList memory holding.

In the manifest for activity: `android:hardwareAccelerated="@bool/gpu_enabled"`

In values.xml for v17:

<bool name="gpu_enabled">false</bool>   

In default values.xml, I set it to true.

Problem

Is anyone knows how to Release bitmaps from android.view.GLES20DisplayList. And why it keeps them alive even if you clean, let's say, ImageView manually? Or maybe there is a way to disable GLES20DisplayList, tried to use android:hardwareAccelerated="false" in AndroidManifest, still no luck. Looks like affected only in 4.2(1) update: looks like you can't disable hardware acceleration on 4.2.1 (bug?) simple test: ``` Android manifest: application ... android:hardwareAccelerated="false" System.out.println("isHardwareAccelerated: " + mListView.isHardwareAccelerated()); mListView.setLayerType(LAYER_TYPE_SOFTWARE, null); System.out.println("isHardwareAccelerated: " + mListView.isHardwareAccelerated()); ``` result: ``` 12-06 17:15:27.129: I/System.out(30752): isHardwareAccelerated: true 12-06 17:15:27.129: I/System.out(30752): isHardwareAccelerated: true ```

Original source