Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix resource leak when a Thread is restarted.
Pthread's own memory resource (created from mmap) must be cleaned up by one of following ways: - pthread_join - pthread_detach (and wait for thread's termination) Previously these methods were not invoked at all when Thread's Start method is called repeatedly. As a result, per-thread memory resource was leaked. The leak (Android version) could be observed by: 0. Launch the app. 1. Show the s/w keyboard and hide it. 2. `adb shell cat /proc/${YOUR_PID}/maps > /tmp/map.1` 3. Show the s/w keyboard and hide it. 4. `adb shell cat /proc/${YOUR_PID}/maps > /tmp/map.2` 5. `diff /tmp/map.1 /tmp/map.2` Following lines in diff for example. 9a6a9000-9a6aa000 ---p 00000000 00:00 0 9a6aa000-9a7a8000 rw-p 00000000 00:00 0 9a7a8000-9a7a9000 ---p 00000000 00:00 0 9a7a9000-9a8a7000 rw-p 00000000 00:00 0 Closes #355. BUG=#355 TEST=manually done with Android 6.0.1 MMB29S and Nexus 5 2013 REF_BUG=26499803 REF_CL=112025510
- Loading branch information