| OLD | NEW |
| 1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2008, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 // --- | 30 // --- |
| 31 // Author: Craig Silverstein | 31 // Author: Craig Silverstein |
| 32 // | 32 // |
| 33 // Simple test of malloc_extension. Includes test of C shims. | 33 // Simple test of malloc_extension. Includes test of C shims. |
| 34 | 34 |
| 35 #include "config_for_unittests.h" | 35 #include "config_for_unittests.h" |
| 36 #include <stdio.h> | 36 #include <stdio.h> |
| 37 #include <sys/types.h> | 37 #include <sys/types.h> |
| 38 #include "base/logging.h" | 38 #include "base/logging.h" |
| 39 #include <google/malloc_extension.h> | 39 #include <gperftools/malloc_extension.h> |
| 40 #include <google/malloc_extension_c.h> | 40 #include <gperftools/malloc_extension_c.h> |
| 41 | 41 |
| 42 using STL_NAMESPACE::vector; | 42 using STL_NAMESPACE::vector; |
| 43 | 43 |
| 44 int main(int argc, char** argv) { | 44 int main(int argc, char** argv) { |
| 45 void* a = malloc(1000); | 45 void* a = malloc(1000); |
| 46 | 46 |
| 47 size_t cxx_bytes_used, c_bytes_used; | 47 size_t cxx_bytes_used, c_bytes_used; |
| 48 ASSERT_TRUE(MallocExtension::instance()->GetNumericProperty( | 48 ASSERT_TRUE(MallocExtension::instance()->GetNumericProperty( |
| 49 "generic.current_allocated_bytes", &cxx_bytes_used)); | 49 "generic.current_allocated_bytes", &cxx_bytes_used)); |
| 50 ASSERT_TRUE(MallocExtension_GetNumericProperty( | 50 ASSERT_TRUE(MallocExtension_GetNumericProperty( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 ASSERT_EQ(static_cast<int>(MallocExtension::kUnknownOwnership), | 90 ASSERT_EQ(static_cast<int>(MallocExtension::kUnknownOwnership), |
| 91 static_cast<int>(MallocExtension_kUnknownOwnership)); | 91 static_cast<int>(MallocExtension_kUnknownOwnership)); |
| 92 ASSERT_EQ(static_cast<int>(MallocExtension::kOwned), | 92 ASSERT_EQ(static_cast<int>(MallocExtension::kOwned), |
| 93 static_cast<int>(MallocExtension_kOwned)); | 93 static_cast<int>(MallocExtension_kOwned)); |
| 94 ASSERT_EQ(static_cast<int>(MallocExtension::kNotOwned), | 94 ASSERT_EQ(static_cast<int>(MallocExtension::kNotOwned), |
| 95 static_cast<int>(MallocExtension_kNotOwned)); | 95 static_cast<int>(MallocExtension_kNotOwned)); |
| 96 | 96 |
| 97 printf("DONE\n"); | 97 printf("DONE\n"); |
| 98 return 0; | 98 return 0; |
| 99 } | 99 } |
| OLD | NEW |