summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vova Sharaienko <sharaienko@google.com> 2022-07-02 03:31:56 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2022-07-02 03:31:56 +0000
commit8de18018ae49277f01ff23acd89e159517fa0b8c (patch)
treea96a932f61c0b0f8d9eb0e34895c038d539f20b1
parentd69bd1e50c4574085a7b0405b9f0163cef5019df (diff)
parent8a7e7fc26592b2dcd15447717ad514a1208ee083 (diff)
Merge "Fixed gpuservice_unittest mem leaks"
-rw-r--r--services/gpuservice/tests/unittests/GpuStatsTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/services/gpuservice/tests/unittests/GpuStatsTest.cpp b/services/gpuservice/tests/unittests/GpuStatsTest.cpp
index 3c7644f369..7ea22888f8 100644
--- a/services/gpuservice/tests/unittests/GpuStatsTest.cpp
+++ b/services/gpuservice/tests/unittests/GpuStatsTest.cpp
@@ -76,6 +76,12 @@ public:
::testing::UnitTest::GetInstance()->current_test_info();
ALOGD("**** Tearing down after %s.%s\n", test_info->test_case_name(), test_info->name());
+ // This is required for test due to GpuStats instance spawns binder transactions
+ // in its destructor. After the gtest destructor test exits immidiatelly.
+ // It results in binder thread not able to process above binder transactions and memory leak
+ // occures. Binder thread needs time to process callbacks transactions.
+ // It leads to GpuStats instance destructor needs to be called in advance.
+ mGpuStats.reset(nullptr);
// performs all pending callbacks until all data has been consumed
// gives time to process binder transactions by thread pool
looper->pollAll(1000);