Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a7e7fc2 authored by Vova Sharaienko's avatar Vova Sharaienko
Browse files

Fixed gpuservice_unittest mem leaks

  Updated GpuStatsTest to destroy GpuStats instance in advance.
  It enables binder to process pending transactions prior test is
  destroyed, preventing memory leaks.

Bug: 222527290
Test: atest gpuservice_unittest
Change-Id: Icf9dfe895b835f2be2d0f69d74e978277b9e1579
parent 0eb46176
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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);