diff options
author | Tony Mak <tonymak@google.com> | 2020-02-06 14:52:57 +0000 |
---|---|---|
committer | Tony Mak <tonymak@google.com> | 2020-02-07 11:54:26 +0000 |
commit | 53195e0da7a1fe95bfd5cfac57c9fe4d11849f5e (patch) | |
tree | 4f407a8513992f0c758c174679ad9544af864717 /rs/java/android/renderscript/ProgramFragmentFixedFunction.java | |
parent | 2cfc5bb18b63e2828cd210edf846f7feb63292d9 (diff) |
Fix memory leak in TCMS when TCSession.destroy() is not called.
TCMS stores sessions in a Map and remove it when the session is
destroyed. Memory leak happens if the client forget to call
TCSession.destroy() or does not have a chance to call before the process
is dead.
Solution:
1. Use linkToDeath() to remove the cached session when client process
is dead. TCSessionID now contains a binder to make this possible.
2. Install a Cleaner to TCSession object such that destroy() is called
whenever the session object is going to be GCed. This is needed
because some clients may have a long lifecycle, e.g. apps that are
bounded by system.
BUG:149012454
Test: Write an app that creates a TC session, but not calling destory().
Then make sure TCMS removed the session in the following situations:
1. The app is killed
2. TCSession object is GCed (By forcing GC)
By checking the output dumpsys textclassificataion, we can know
that the session object is removed
Test: mts-tradefed run mts-extservices
Test: Sanity test: smart selection + smart replies
Change-Id: Ifb7dcb23e1f50d4b3e97a6ce40e63b57193f2892
Diffstat (limited to 'rs/java/android/renderscript/ProgramFragmentFixedFunction.java')
0 files changed, 0 insertions, 0 deletions