diff options
author | Denis Hsu <denis.hsu@mediatek.com> | 2018-01-15 18:49:01 +0800 |
---|---|---|
committer | Denis Hsu <denis.hsu@mediatek.com> | 2018-01-16 17:43:53 +0800 |
commit | 1a8106ec1aba6a5317f3dbfc3e8073630c18975b (patch) | |
tree | 5b44ad966491ae76335e68ee1279032da95835b5 /libc/malloc_debug/DebugData.cpp | |
parent | d16b09a4d2832d0daea6d211a6b5b5312d404425 (diff) |
malloc debug: reset FreeTrackData mutex after fork
Lock the FreeTrackData mutex during fork and reset it in the child.
Ensures that the FreeTrackData is consistent when forking from a
multi-threaded process, and that the mutex is in a defined state
in the child.
Test: 89hours MTBF test
Change-Id: I5e5892832a733ea85727ec65abc7094d95a725ef
Diffstat (limited to 'libc/malloc_debug/DebugData.cpp')
-rw-r--r-- | libc/malloc_debug/DebugData.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libc/malloc_debug/DebugData.cpp b/libc/malloc_debug/DebugData.cpp index d6ca99886..76f8fbb1e 100644 --- a/libc/malloc_debug/DebugData.cpp +++ b/libc/malloc_debug/DebugData.cpp @@ -94,16 +94,25 @@ void DebugData::PrepareFork() { if (track != nullptr) { track->PrepareFork(); } + if (free_track != nullptr) { + free_track->PrepareFork(); + } } void DebugData::PostForkParent() { if (track != nullptr) { track->PostForkParent(); } + if (free_track != nullptr) { + free_track->PostForkParent(); + } } void DebugData::PostForkChild() { if (track != nullptr) { track->PostForkChild(); } + if (free_track != nullptr) { + free_track->PostForkChild(); + } } |