summaryrefslogtreecommitdiffstats
path: root/libmemunreachable
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-06-21 13:13:00 -0700
committerColin Cross <ccross@android.com>2017-06-22 10:58:23 -0700
commita9939e9a23ea21f4f8dc69cf1dae8e95debadcfb (patch)
tree3ff7dc55ea77d15b821d1f4b011390a881449044 /libmemunreachable
parenta83881e33ce29ee236c924d669cb41a9d816962d (diff)
downloadsystem_core-a9939e9a23ea21f4f8dc69cf1dae8e95debadcfb.tar.gz
system_core-a9939e9a23ea21f4f8dc69cf1dae8e95debadcfb.tar.bz2
system_core-a9939e9a23ea21f4f8dc69cf1dae8e95debadcfb.zip
Move libmemunreachable into namespace android
Putting libmemunreachable in the global C++ namespace was an oversight, move it into namespace android. Test: m -j checkbuild Change-Id: I0799906f6463178cb04a719bb4054cad33a50dbe
Diffstat (limited to 'libmemunreachable')
-rw-r--r--libmemunreachable/Allocator.cpp4
-rw-r--r--libmemunreachable/Allocator.h5
-rw-r--r--libmemunreachable/HeapWalker.cpp4
-rw-r--r--libmemunreachable/HeapWalker.h4
-rw-r--r--libmemunreachable/Leak.h7
-rw-r--r--libmemunreachable/LeakFolding.cpp4
-rw-r--r--libmemunreachable/LeakFolding.h4
-rw-r--r--libmemunreachable/LeakPipe.cpp4
-rw-r--r--libmemunreachable/LeakPipe.h4
-rw-r--r--libmemunreachable/LineBuffer.cpp4
-rw-r--r--libmemunreachable/LineBuffer.h4
-rw-r--r--libmemunreachable/LinkedList.h4
-rw-r--r--libmemunreachable/MemUnreachable.cpp17
-rw-r--r--libmemunreachable/ProcessMappings.cpp4
-rw-r--r--libmemunreachable/ProcessMappings.h4
-rw-r--r--libmemunreachable/PtracerThread.cpp4
-rw-r--r--libmemunreachable/PtracerThread.h4
-rw-r--r--libmemunreachable/ScopedAlarm.h5
-rw-r--r--libmemunreachable/ScopedDisableMalloc.h4
-rw-r--r--libmemunreachable/ScopedPipe.h5
-rw-r--r--libmemunreachable/ScopedSignalHandler.h4
-rw-r--r--libmemunreachable/Semaphore.h4
-rw-r--r--libmemunreachable/Tarjan.h4
-rw-r--r--libmemunreachable/ThreadCapture.cpp4
-rw-r--r--libmemunreachable/ThreadCapture.h4
-rw-r--r--libmemunreachable/include/memunreachable/memunreachable.h5
-rw-r--r--libmemunreachable/tests/Allocator_test.cpp4
-rw-r--r--libmemunreachable/tests/DisableMalloc_test.cpp4
-rw-r--r--libmemunreachable/tests/HeapWalker_test.cpp4
-rw-r--r--libmemunreachable/tests/LeakFolding_test.cpp4
-rw-r--r--libmemunreachable/tests/MemUnreachable_test.cpp4
-rw-r--r--libmemunreachable/tests/ThreadCapture_test.cpp4
32 files changed, 140 insertions, 8 deletions
diff --git a/libmemunreachable/Allocator.cpp b/libmemunreachable/Allocator.cpp
index da6db20f3..213be1733 100644
--- a/libmemunreachable/Allocator.cpp
+++ b/libmemunreachable/Allocator.cpp
@@ -37,6 +37,8 @@
#include "LinkedList.h"
#include "anon_vma_naming.h"
+namespace android {
+
// runtime interfaces used:
// abort
// assert - fprintf + mmap
@@ -462,3 +464,5 @@ void Heap::deallocate(HeapImpl* impl, void* ptr) {
bool Heap::empty() {
return impl_->Empty();
}
+
+} // namespace android
diff --git a/libmemunreachable/Allocator.h b/libmemunreachable/Allocator.h
index 67a068f7d..837a12b7b 100644
--- a/libmemunreachable/Allocator.h
+++ b/libmemunreachable/Allocator.h
@@ -27,6 +27,9 @@
#include <unordered_map>
#include <unordered_set>
#include <vector>
+
+namespace android {
+
extern std::atomic<int> heap_count;
class HeapImpl;
@@ -210,4 +213,6 @@ using set = std::set<Key, Compare, Allocator<Key>>;
using string = std::basic_string<char, std::char_traits<char>, Allocator<char>>;
}
+} // namespace android
+
#endif
diff --git a/libmemunreachable/HeapWalker.cpp b/libmemunreachable/HeapWalker.cpp
index df16f4078..2403ad085 100644
--- a/libmemunreachable/HeapWalker.cpp
+++ b/libmemunreachable/HeapWalker.cpp
@@ -28,6 +28,8 @@
#include "ScopedSignalHandler.h"
#include "log.h"
+namespace android {
+
bool HeapWalker::Allocation(uintptr_t begin, uintptr_t end) {
if (end == begin) {
end = begin + 1;
@@ -173,3 +175,5 @@ void HeapWalker::HandleSegFault(ScopedSignalHandler& handler, int signal, siginf
}
ScopedSignalHandler::SignalFn ScopedSignalHandler::handler_;
+
+} // namespace android
diff --git a/libmemunreachable/HeapWalker.h b/libmemunreachable/HeapWalker.h
index 865965a41..5c7ec136b 100644
--- a/libmemunreachable/HeapWalker.h
+++ b/libmemunreachable/HeapWalker.h
@@ -25,6 +25,8 @@
#include "ScopedSignalHandler.h"
#include "Tarjan.h"
+namespace android {
+
// A range [begin, end)
struct Range {
uintptr_t begin;
@@ -125,4 +127,6 @@ inline void HeapWalker::ForEachAllocation(F&& f) {
}
}
+} // namespace android
+
#endif
diff --git a/libmemunreachable/Leak.h b/libmemunreachable/Leak.h
index db88e2949..de64b6410 100644
--- a/libmemunreachable/Leak.h
+++ b/libmemunreachable/Leak.h
@@ -27,8 +27,8 @@
namespace std {
template <>
-struct hash<Leak::Backtrace> {
- std::size_t operator()(const Leak::Backtrace& key) const {
+struct hash<android::Leak::Backtrace> {
+ std::size_t operator()(const android::Leak::Backtrace& key) const {
std::size_t seed = 0;
hash_combine(seed, key.num_frames);
@@ -49,9 +49,12 @@ struct hash<Leak::Backtrace> {
} // namespace std
+namespace android {
+
static bool operator==(const Leak::Backtrace& lhs, const Leak::Backtrace& rhs) {
return (lhs.num_frames == rhs.num_frames) &&
memcmp(lhs.frames, rhs.frames, lhs.num_frames * sizeof(lhs.frames[0])) == 0;
}
+}
#endif
diff --git a/libmemunreachable/LeakFolding.cpp b/libmemunreachable/LeakFolding.cpp
index 2dff6728f..69f320cc7 100644
--- a/libmemunreachable/LeakFolding.cpp
+++ b/libmemunreachable/LeakFolding.cpp
@@ -22,6 +22,8 @@
#include "Tarjan.h"
#include "log.h"
+namespace android {
+
// Converts possibly cyclic graph of leaks to a DAG by combining
// strongly-connected components into a object, stored in the scc pointer
// of each node in the component.
@@ -132,3 +134,5 @@ bool LeakFolding::Leaked(allocator::vector<LeakFolding::Leak>& leaked, size_t* n
return true;
}
+
+} // namespace android
diff --git a/libmemunreachable/LeakFolding.h b/libmemunreachable/LeakFolding.h
index 740b54fae..09affac9a 100644
--- a/libmemunreachable/LeakFolding.h
+++ b/libmemunreachable/LeakFolding.h
@@ -19,6 +19,8 @@
#include "HeapWalker.h"
+namespace android {
+
class LeakFolding {
public:
LeakFolding(Allocator<void> allocator, HeapWalker& heap_walker)
@@ -93,4 +95,6 @@ class LeakFolding {
allocator::vector<Allocator<SCCInfo>::unique_ptr> leak_scc_;
};
+} // namespace android
+
#endif // LIBMEMUNREACHABLE_LEAK_FOLDING_H_
diff --git a/libmemunreachable/LeakPipe.cpp b/libmemunreachable/LeakPipe.cpp
index aac5701e1..8ea9ad68b 100644
--- a/libmemunreachable/LeakPipe.cpp
+++ b/libmemunreachable/LeakPipe.cpp
@@ -21,6 +21,8 @@
#include "log.h"
+namespace android {
+
bool LeakPipe::SendFd(int sock, int fd) {
struct msghdr hdr {};
struct iovec iov {};
@@ -87,3 +89,5 @@ int LeakPipe::ReceiveFd(int sock) {
return *(int*)CMSG_DATA(cmsg);
}
+
+} // namespace android
diff --git a/libmemunreachable/LeakPipe.h b/libmemunreachable/LeakPipe.h
index e6aee5f6b..94d4aa486 100644
--- a/libmemunreachable/LeakPipe.h
+++ b/libmemunreachable/LeakPipe.h
@@ -26,6 +26,8 @@
#include "ScopedPipe.h"
#include "log.h"
+namespace android {
+
// LeakPipe implements a pipe that can transfer vectors of simple objects
// between processes. The pipe is created in the sending process and
// transferred over a socketpair that was created before forking. This ensures
@@ -187,4 +189,6 @@ class LeakPipe {
int sv_[2];
};
+} // namespace android
+
#endif // LIBMEMUNREACHABLE_LEAK_PIPE_H_
diff --git a/libmemunreachable/LineBuffer.cpp b/libmemunreachable/LineBuffer.cpp
index 0709fdd19..4ea0542c7 100644
--- a/libmemunreachable/LineBuffer.cpp
+++ b/libmemunreachable/LineBuffer.cpp
@@ -23,6 +23,8 @@
#include "LineBuffer.h"
+namespace android {
+
LineBuffer::LineBuffer(int fd, char* buffer, size_t buffer_len)
: fd_(fd), buffer_(buffer), buffer_len_(buffer_len) {}
@@ -60,3 +62,5 @@ bool LineBuffer::GetLine(char** line, size_t* line_len) {
bytes_ += bytes;
}
}
+
+} // namespace android
diff --git a/libmemunreachable/LineBuffer.h b/libmemunreachable/LineBuffer.h
index 604836bef..cc6cd0c6a 100644
--- a/libmemunreachable/LineBuffer.h
+++ b/libmemunreachable/LineBuffer.h
@@ -19,6 +19,8 @@
#include <stdint.h>
+namespace android {
+
class LineBuffer {
public:
LineBuffer(int fd, char* buffer, size_t buffer_len);
@@ -33,4 +35,6 @@ class LineBuffer {
size_t bytes_ = 0;
};
+} // namespace android
+
#endif // _LIBMEMUNREACHABLE_LINE_BUFFER_H
diff --git a/libmemunreachable/LinkedList.h b/libmemunreachable/LinkedList.h
index f1b8a17fe..36fe9fd1b 100644
--- a/libmemunreachable/LinkedList.h
+++ b/libmemunreachable/LinkedList.h
@@ -17,6 +17,8 @@
#ifndef LIBMEMUNREACHABLE_LINKED_LIST_H_
#define LIBMEMUNREACHABLE_LINKED_LIST_H_
+namespace android {
+
template <class T>
class LinkedList {
public:
@@ -56,4 +58,6 @@ class LinkedListHead {
LinkedList<T> node_;
};
+} // namespace android
+
#endif
diff --git a/libmemunreachable/MemUnreachable.cpp b/libmemunreachable/MemUnreachable.cpp
index 870cd1d16..a1f74c333 100644
--- a/libmemunreachable/MemUnreachable.cpp
+++ b/libmemunreachable/MemUnreachable.cpp
@@ -15,6 +15,7 @@
*/
#include <inttypes.h>
+#include <string.h>
#include <functional>
#include <iomanip>
@@ -41,10 +42,12 @@
#include "log.h"
#include "memunreachable/memunreachable.h"
-const size_t Leak::contents_length;
-
using namespace std::chrono_literals;
+namespace android {
+
+const size_t Leak::contents_length;
+
class MemUnreachable {
public:
MemUnreachable(pid_t pid, Allocator<void> allocator)
@@ -510,9 +513,11 @@ std::string GetUnreachableMemoryString(bool log_contents, size_t limit) {
return info.ToString(log_contents);
}
+} // namespace android
+
bool LogUnreachableMemory(bool log_contents, size_t limit) {
- UnreachableMemoryInfo info;
- if (!GetUnreachableMemory(info, limit)) {
+ android::UnreachableMemoryInfo info;
+ if (!android::GetUnreachableMemory(info, limit)) {
return false;
}
@@ -523,8 +528,8 @@ bool LogUnreachableMemory(bool log_contents, size_t limit) {
}
bool NoLeaks() {
- UnreachableMemoryInfo info;
- if (!GetUnreachableMemory(info, 0)) {
+ android::UnreachableMemoryInfo info;
+ if (!android::GetUnreachableMemory(info, 0)) {
return false;
}
diff --git a/libmemunreachable/ProcessMappings.cpp b/libmemunreachable/ProcessMappings.cpp
index 42e532627..9a0687052 100644
--- a/libmemunreachable/ProcessMappings.cpp
+++ b/libmemunreachable/ProcessMappings.cpp
@@ -25,6 +25,8 @@
#include "ProcessMappings.h"
#include "log.h"
+namespace android {
+
// This function is not re-entrant since it uses a static buffer for
// the line data.
bool ProcessMappings(pid_t pid, allocator::vector<Mapping>& mappings) {
@@ -64,3 +66,5 @@ bool ProcessMappings(pid_t pid, allocator::vector<Mapping>& mappings) {
}
return true;
}
+
+} // namespace android
diff --git a/libmemunreachable/ProcessMappings.h b/libmemunreachable/ProcessMappings.h
index 81b33dc16..a0e97e9fc 100644
--- a/libmemunreachable/ProcessMappings.h
+++ b/libmemunreachable/ProcessMappings.h
@@ -19,6 +19,8 @@
#include "Allocator.h"
+namespace android {
+
struct Mapping {
uintptr_t begin;
uintptr_t end;
@@ -33,4 +35,6 @@ struct Mapping {
// the line data.
bool ProcessMappings(pid_t pid, allocator::vector<Mapping>& mappings);
+} // namespace android
+
#endif // LIBMEMUNREACHABLE_PROCESS_MAPPING_H_
diff --git a/libmemunreachable/PtracerThread.cpp b/libmemunreachable/PtracerThread.cpp
index 41efa9c6f..aca2a8242 100644
--- a/libmemunreachable/PtracerThread.cpp
+++ b/libmemunreachable/PtracerThread.cpp
@@ -35,6 +35,8 @@
#include "anon_vma_naming.h"
#include "log.h"
+namespace android {
+
class Stack {
public:
explicit Stack(size_t size) : size_(size) {
@@ -148,3 +150,5 @@ void PtracerThread::SetTracer(pid_t tracer_pid) {
void PtracerThread::ClearTracer() {
prctl(PR_SET_PTRACER, 0);
}
+
+} // namespace android
diff --git a/libmemunreachable/PtracerThread.h b/libmemunreachable/PtracerThread.h
index ddf902677..4f9c42021 100644
--- a/libmemunreachable/PtracerThread.h
+++ b/libmemunreachable/PtracerThread.h
@@ -24,6 +24,8 @@
#include "Allocator.h"
+namespace android {
+
class Stack;
// PtracerThread is similar to std::thread, except that it creates a "thread"
@@ -48,4 +50,6 @@ class PtracerThread {
pid_t child_pid_;
};
+} // namespace android
+
#endif // LIBMEMUNREACHABLE_PTRACER_THREAD_H_
diff --git a/libmemunreachable/ScopedAlarm.h b/libmemunreachable/ScopedAlarm.h
index 53ea11206..bb50b9e92 100644
--- a/libmemunreachable/ScopedAlarm.h
+++ b/libmemunreachable/ScopedAlarm.h
@@ -23,6 +23,8 @@
#include <chrono>
#include <functional>
+namespace android {
+
class ScopedAlarm {
public:
ScopedAlarm(std::chrono::microseconds us, std::function<void()> func) {
@@ -49,4 +51,7 @@ class ScopedAlarm {
private:
static std::function<void()> func_;
};
+
+} // namespace android
+
#endif
diff --git a/libmemunreachable/ScopedDisableMalloc.h b/libmemunreachable/ScopedDisableMalloc.h
index 7d2f630b4..655e82687 100644
--- a/libmemunreachable/ScopedDisableMalloc.h
+++ b/libmemunreachable/ScopedDisableMalloc.h
@@ -25,6 +25,8 @@
#include "bionic.h"
#include "log.h"
+namespace android {
+
class DisableMallocGuard {
public:
DisableMallocGuard() : disabled_(false) {}
@@ -102,4 +104,6 @@ class ScopedDisableMallocTimeout {
DisableMallocGuard disable_malloc_;
};
+} // namespace android
+
#endif // LIBMEMUNREACHABLE_SCOPED_DISABLE_MALLOC_H_
diff --git a/libmemunreachable/ScopedPipe.h b/libmemunreachable/ScopedPipe.h
index 76bd974bb..adabfd8b7 100644
--- a/libmemunreachable/ScopedPipe.h
+++ b/libmemunreachable/ScopedPipe.h
@@ -21,6 +21,8 @@
#include "log.h"
+namespace android {
+
class ScopedPipe {
public:
ScopedPipe() : pipefd_{-1, -1} {
@@ -72,4 +74,7 @@ class ScopedPipe {
int pipefd_[2];
};
+
+} // namespace android
+
#endif
diff --git a/libmemunreachable/ScopedSignalHandler.h b/libmemunreachable/ScopedSignalHandler.h
index 58ac2aaef..f62f368fd 100644
--- a/libmemunreachable/ScopedSignalHandler.h
+++ b/libmemunreachable/ScopedSignalHandler.h
@@ -26,6 +26,8 @@
#include "log.h"
+namespace android {
+
class ScopedSignalHandler {
public:
using Fn = std::function<void(ScopedSignalHandler&, int, siginfo_t*, void*)>;
@@ -74,4 +76,6 @@ class ScopedSignalHandler {
static SignalFn handler_;
};
+} // namespace android
+
#endif // LIBMEMUNREACHABLE_SCOPED_SIGNAL_HANDLER_H_
diff --git a/libmemunreachable/Semaphore.h b/libmemunreachable/Semaphore.h
index 6d39a9316..cd7397266 100644
--- a/libmemunreachable/Semaphore.h
+++ b/libmemunreachable/Semaphore.h
@@ -22,6 +22,8 @@
#include "android-base/macros.h"
+namespace android {
+
class Semaphore {
public:
explicit Semaphore(int count = 0) : count_(count) {}
@@ -53,4 +55,6 @@ class Semaphore {
std::condition_variable cv_;
};
+} // namespace android
+
#endif // LIBMEMUNREACHABLE_SEMAPHORE_H_
diff --git a/libmemunreachable/Tarjan.h b/libmemunreachable/Tarjan.h
index 86c73605f..355679f72 100644
--- a/libmemunreachable/Tarjan.h
+++ b/libmemunreachable/Tarjan.h
@@ -24,6 +24,8 @@
#include "Allocator.h"
+namespace android {
+
template <class T>
class Node {
public:
@@ -131,4 +133,6 @@ void Tarjan(Graph<T>& graph, SCCList<T>& out) {
tarjan.Execute(graph, out);
}
+} // namespace android
+
#endif // LIBMEMUNREACHABLE_TARJAN_H_
diff --git a/libmemunreachable/ThreadCapture.cpp b/libmemunreachable/ThreadCapture.cpp
index a7bd91cf0..45eb55de8 100644
--- a/libmemunreachable/ThreadCapture.cpp
+++ b/libmemunreachable/ThreadCapture.cpp
@@ -39,6 +39,8 @@
#include "Allocator.h"
#include "log.h"
+namespace android {
+
// bionic interfaces used:
// atoi
// strlcat
@@ -361,3 +363,5 @@ bool ThreadCapture::CapturedThreadInfo(ThreadInfoList& threads) {
void ThreadCapture::InjectTestFunc(std::function<void(pid_t)>&& f) {
impl_->InjectTestFunc(std::forward<std::function<void(pid_t)>>(f));
}
+
+} // namespace android
diff --git a/libmemunreachable/ThreadCapture.h b/libmemunreachable/ThreadCapture.h
index d20966028..961cb60fa 100644
--- a/libmemunreachable/ThreadCapture.h
+++ b/libmemunreachable/ThreadCapture.h
@@ -21,6 +21,8 @@
#include "Allocator.h"
+namespace android {
+
struct ThreadInfo {
pid_t tid;
allocator::vector<uintptr_t> regs;
@@ -51,4 +53,6 @@ class ThreadCapture {
Allocator<ThreadCaptureImpl>::unique_ptr impl_;
};
+} // namespace android
+
#endif
diff --git a/libmemunreachable/include/memunreachable/memunreachable.h b/libmemunreachable/include/memunreachable/memunreachable.h
index f6249e3a6..438fcafe1 100644
--- a/libmemunreachable/include/memunreachable/memunreachable.h
+++ b/libmemunreachable/include/memunreachable/memunreachable.h
@@ -17,6 +17,7 @@
#ifndef LIBMEMUNREACHABLE_MEMUNREACHABLE_H_
#define LIBMEMUNREACHABLE_MEMUNREACHABLE_H_
+#include <string.h>
#include <sys/cdefs.h>
#ifdef __cplusplus
@@ -24,6 +25,8 @@
#include <string>
#include <vector>
+namespace android {
+
struct Leak {
uintptr_t begin;
size_t size;
@@ -73,6 +76,8 @@ bool GetUnreachableMemory(UnreachableMemoryInfo& info, size_t limit = 100);
std::string GetUnreachableMemoryString(bool log_contents = false, size_t limit = 100);
+} // namespace android
+
#endif
__BEGIN_DECLS
diff --git a/libmemunreachable/tests/Allocator_test.cpp b/libmemunreachable/tests/Allocator_test.cpp
index 0bb4f3134..8991a7b0b 100644
--- a/libmemunreachable/tests/Allocator_test.cpp
+++ b/libmemunreachable/tests/Allocator_test.cpp
@@ -19,6 +19,8 @@
#include <ScopedDisableMalloc.h>
#include <gtest/gtest.h>
+namespace android {
+
std::function<void()> ScopedAlarm::func_;
class AllocatorTest : public testing::Test {
@@ -170,3 +172,5 @@ TEST_F(AllocatorTest, unique) {
ASSERT_NE(ptr, nullptr);
}
+
+} // namespace android
diff --git a/libmemunreachable/tests/DisableMalloc_test.cpp b/libmemunreachable/tests/DisableMalloc_test.cpp
index 2db584839..c630049fc 100644
--- a/libmemunreachable/tests/DisableMalloc_test.cpp
+++ b/libmemunreachable/tests/DisableMalloc_test.cpp
@@ -24,6 +24,8 @@
using namespace std::chrono_literals;
+namespace android {
+
class DisableMallocTest : public ::testing::Test {
protected:
void alarm(std::chrono::microseconds us) {
@@ -124,3 +126,5 @@ TEST_F(DisableMallocTest, deadlock_fork) {
}
}, "");
}
+
+} // namespace android
diff --git a/libmemunreachable/tests/HeapWalker_test.cpp b/libmemunreachable/tests/HeapWalker_test.cpp
index 1b258ee75..84a0ec63b 100644
--- a/libmemunreachable/tests/HeapWalker_test.cpp
+++ b/libmemunreachable/tests/HeapWalker_test.cpp
@@ -23,6 +23,8 @@
#include <gtest/gtest.h>
#include "Allocator.h"
+namespace android {
+
class HeapWalkerTest : public ::testing::Test {
public:
HeapWalkerTest() : disable_malloc_(), heap_() {}
@@ -199,3 +201,5 @@ TEST_F(HeapWalkerTest, segv) {
EXPECT_EQ(0U, leaked_bytes);
ASSERT_EQ(0U, leaked.size());
}
+
+} // namespace android
diff --git a/libmemunreachable/tests/LeakFolding_test.cpp b/libmemunreachable/tests/LeakFolding_test.cpp
index 7ae7f7607..f5b363140 100644
--- a/libmemunreachable/tests/LeakFolding_test.cpp
+++ b/libmemunreachable/tests/LeakFolding_test.cpp
@@ -21,6 +21,8 @@
#include <gtest/gtest.h>
#include "Allocator.h"
+namespace android {
+
class LeakFoldingTest : public ::testing::Test {
public:
LeakFoldingTest() : disable_malloc_(), heap_() {}
@@ -425,3 +427,5 @@ TEST_F(LeakFoldingTest, multicycle) {
EXPECT_EQ(3U, leaked[3].referenced_count);
EXPECT_EQ(6 * sizeof(uintptr_t), leaked[3].referenced_size);
}
+
+} // namespace android
diff --git a/libmemunreachable/tests/MemUnreachable_test.cpp b/libmemunreachable/tests/MemUnreachable_test.cpp
index a231f4fb6..bb6bcbc7a 100644
--- a/libmemunreachable/tests/MemUnreachable_test.cpp
+++ b/libmemunreachable/tests/MemUnreachable_test.cpp
@@ -23,6 +23,8 @@
#include <memunreachable/memunreachable.h>
+namespace android {
+
class HiddenPointer {
public:
explicit HiddenPointer(size_t size = 256) { Set(malloc(size)); }
@@ -209,3 +211,5 @@ TEST(MemunreachableTest, leak_lots) {
ASSERT_TRUE(LogUnreachableMemory(true, 100));
}
+
+} // namespace android
diff --git a/libmemunreachable/tests/ThreadCapture_test.cpp b/libmemunreachable/tests/ThreadCapture_test.cpp
index 5bcb79e51..4fbf729ad 100644
--- a/libmemunreachable/tests/ThreadCapture_test.cpp
+++ b/libmemunreachable/tests/ThreadCapture_test.cpp
@@ -34,6 +34,8 @@
using namespace std::chrono_literals;
+namespace android {
+
class ThreadListTest : public ::testing::TestWithParam<int> {
public:
ThreadListTest() : stop_(false) {}
@@ -343,3 +345,5 @@ TEST_F(ThreadCaptureTest, capture_signal) {
}
});
}
+
+} // namespace android