| Index: third_party/tcmalloc/chromium/src/tests/malloc_extension_test.cc
|
| diff --git a/third_party/tcmalloc/chromium/src/tests/malloc_extension_test.cc b/third_party/tcmalloc/chromium/src/tests/malloc_extension_test.cc
|
| index 0bd85adc1f5790a3157b3302d2028000ff037256..58fef7ea2b578f3ef5eb99726d40c0dcc9f1c263 100644
|
| --- a/third_party/tcmalloc/chromium/src/tests/malloc_extension_test.cc
|
| +++ b/third_party/tcmalloc/chromium/src/tests/malloc_extension_test.cc
|
| @@ -36,8 +36,8 @@
|
| #include <stdio.h>
|
| #include <sys/types.h>
|
| #include "base/logging.h"
|
| -#include <google/malloc_extension.h>
|
| -#include <google/malloc_extension_c.h>
|
| +#include <gperftools/malloc_extension.h>
|
| +#include <gperftools/malloc_extension_c.h>
|
|
|
| using STL_NAMESPACE::vector;
|
|
|
| @@ -55,6 +55,14 @@ int main(int argc, char** argv) {
|
| ASSERT_TRUE(MallocExtension::instance()->VerifyAllMemory());
|
| ASSERT_TRUE(MallocExtension_VerifyAllMemory());
|
|
|
| + ASSERT_EQ(MallocExtension::kOwned,
|
| + MallocExtension::instance()->GetOwnership(a));
|
| + // TODO(csilvers): this relies on undocumented behavior that
|
| + // GetOwnership works on stack-allocated variables. Use a better test.
|
| + ASSERT_EQ(MallocExtension::kNotOwned,
|
| + MallocExtension::instance()->GetOwnership(&cxx_bytes_used));
|
| + ASSERT_EQ(MallocExtension::kNotOwned,
|
| + MallocExtension::instance()->GetOwnership(NULL));
|
| ASSERT_GE(MallocExtension::instance()->GetAllocatedSize(a), 1000);
|
| // This is just a sanity check. If we allocated too much, tcmalloc is broken
|
| ASSERT_LE(MallocExtension::instance()->GetAllocatedSize(a), 5000);
|
| @@ -68,12 +76,24 @@ int main(int argc, char** argv) {
|
| }
|
|
|
| // Check the c-shim version too.
|
| + ASSERT_EQ(MallocExtension_kOwned, MallocExtension_GetOwnership(a));
|
| + ASSERT_EQ(MallocExtension_kNotOwned,
|
| + MallocExtension_GetOwnership(&cxx_bytes_used));
|
| + ASSERT_EQ(MallocExtension_kNotOwned, MallocExtension_GetOwnership(NULL));
|
| ASSERT_GE(MallocExtension_GetAllocatedSize(a), 1000);
|
| ASSERT_LE(MallocExtension_GetAllocatedSize(a), 5000);
|
| ASSERT_GE(MallocExtension_GetEstimatedAllocatedSize(1000), 1000);
|
|
|
| free(a);
|
|
|
| + // Verify that the .cc file and .h file have the same enum values.
|
| + ASSERT_EQ(static_cast<int>(MallocExtension::kUnknownOwnership),
|
| + static_cast<int>(MallocExtension_kUnknownOwnership));
|
| + ASSERT_EQ(static_cast<int>(MallocExtension::kOwned),
|
| + static_cast<int>(MallocExtension_kOwned));
|
| + ASSERT_EQ(static_cast<int>(MallocExtension::kNotOwned),
|
| + static_cast<int>(MallocExtension_kNotOwned));
|
| +
|
| printf("DONE\n");
|
| return 0;
|
| }
|
|
|