Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

android - 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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...