summaryrefslogtreecommitdiff
path: root/libs/hwui/Properties.h
diff options
context:
space:
mode:
authorcaiqinl <caiqinl@codeaurora.org>2016-06-24 13:37:46 +0800
committerDigish Pandya <digishp@codeaurora.org>2016-08-22 11:22:43 +0530
commit4b505376cb1d77de39d12f4f8bc88e111fbbdc5f (patch)
tree5395a8383bccdba200c7267974e50501608c552b /libs/hwui/Properties.h
parente40ab1859079e317640399e0891ded0b54bef69f (diff)
Fix native memory leak caused by small HWUI path cache creation
HWUI calculates the texture size as w*h*bpp. In some cases, the calculated path cache is small, but the actual memory allocated in driver is 4k/8k/16k, much bigger than HWUI calculates. Example: a 5*65 alpha texture, HWUI think it is 5*65*1 = 325 bytes, but driver allocates 8K. An app can allocates up to 32M path textures, which actually consumes 32M*(8*1024/325) = 806M memory. Here we limit the number of path texture in the cache to 256, it should be a pretty generous global limit. Change-Id: I890819b73bb0b7f63e96bc3d9d0ff9469c16838c
Diffstat (limited to 'libs/hwui/Properties.h')
-rw-r--r--libs/hwui/Properties.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index 5dea49387921..64dcc7d3c71a 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -249,6 +249,9 @@ enum DebugLevel {
#define DEFAULT_TEXT_BLACK_GAMMA_THRESHOLD 64
#define DEFAULT_TEXT_WHITE_GAMMA_THRESHOLD 192
+// cap to 256 to limite paths in the path cache
+#define DEFAULT_PATH_TEXTURE_CAP 256
+
///////////////////////////////////////////////////////////////////////////////
// Misc
///////////////////////////////////////////////////////////////////////////////