OSDN Git Service

Fix a memory leak in the osi allocation tracker
authorPavlin Radoslavov <pavlin@google.com>
Fri, 3 Feb 2017 03:47:16 +0000 (19:47 -0800)
committerPavlin Radoslavov <pavlin@google.com>
Fri, 3 Feb 2017 03:47:16 +0000 (19:47 -0800)
commit1aa40037fde7e57ae99468b9dd40e7788ed3978b
tree633b99952c0d0c6994c9a839d34d6998e5a23ef5
parent064e8d1273fa03710b7db24572e4f79248ef978e
Fix a memory leak in the osi allocation tracker

Add a missing free(allocation) inside allocation_tracker_notify_free()
when freeing a memory buffer.

Prior to switching the allocation tracker to use C++ unordered_map,
the "allocation" bin was kept within (and reused) by the older hash_map
mechanism. However, after the switch to the C++ unordered_map this
is no longer the case, hence the memory leak.

Test: watch -n 1 "adb shell dumpsys meminfo -d BT-PID | grep Heap"
Bug: 34785845
Change-Id: I737c901a6452d29d18fd8b847e7d5ea10c5ff485
osi/src/allocation_tracker.cc