Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tag: TextLayoutCache Text: Cache Value deleted

While debugging my Android app at certain point I'm seeing a huge amount of entries in the LogCat with the

Tag: TextLayoutCache Text: Cache Value 0x51b9f578 deleted, size=168 (the hexa value changes from entry to entry)

Does anyone know what this about? Memory leak? Any ideas how to solve it if it is a problem? Thanks!

like image 886
polonskyg Avatar asked Jul 03 '13 13:07

polonskyg


1 Answers

There doesn't seem to be a definitive answer on the net, so I had a look at the code for TextLayoutCache.cpp. Looks fine to me. It's caching text layout data to improve performance, and there's currently a fixed default cache size of 0.5MB defined in TextLayoutCache.h.

So if you're changing layout text to a fixed set of values (<0.5MB), you won't see the log message.

If you change text to dynamic values then eventually the cache will fill and the LRU (least recently used) cache entry is deleted, and you'll see the log message. It's just a debug message, not an error, not a leak. It's a useful performance metric about how Android internals are handling our App.

Note that TextLayoutCache isn't used in Android versions >= 5.

like image 94
Nick Westgate Avatar answered Nov 04 '22 22:11

Nick Westgate