Fix the memory leak in nsd tests
The NsdManager constructor creates a new thread, which is not intended to be closed. However, the test in NsdMangerTest and NsdServiceTest create a new NsdManager instance, resulting in a large number of threads running during the tests. This can lead to an out-of-memory error for the tests. To resolve this issue, use the common singleton thread ConnectivityThread to handle tasks from the various instances. Fix: 308544734 Test: atest ConnectivityCoverageTests --test-filter Nsd* Change-Id: I1908a2bb1bd20da8e0498353bca26f7e89e16626
Showing
- framework-t/src/android/net/nsd/NsdManager.java 4 additions, 5 deletionsframework-t/src/android/net/nsd/NsdManager.java
- tests/unit/java/android/net/nsd/NsdManagerTest.java 1 addition, 0 deletionstests/unit/java/android/net/nsd/NsdManagerTest.java
- tests/unit/java/com/android/server/NsdServiceTest.java 1 addition, 0 deletionstests/unit/java/com/android/server/NsdServiceTest.java
Please register or sign in to comment