| OLD | NEW |
| 1 // Copyright (c) 2005, Google Inc. | 1 // Copyright (c) 2005, 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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 (kPageSize > FLAGS_tcmalloc_large_alloc_report_threshold | 1006 (kPageSize > FLAGS_tcmalloc_large_alloc_report_threshold |
| 1007 ? kPageSize : FLAGS_tcmalloc_large_alloc_report_threshold); | 1007 ? kPageSize : FLAGS_tcmalloc_large_alloc_report_threshold); |
| 1008 | 1008 |
| 1009 static void ReportLargeAlloc(Length num_pages, void* result) { | 1009 static void ReportLargeAlloc(Length num_pages, void* result) { |
| 1010 StackTrace stack; | 1010 StackTrace stack; |
| 1011 stack.depth = GetStackTrace(stack.stack, tcmalloc::kMaxStackDepth, 1); | 1011 stack.depth = GetStackTrace(stack.stack, tcmalloc::kMaxStackDepth, 1); |
| 1012 | 1012 |
| 1013 static const int N = 1000; | 1013 static const int N = 1000; |
| 1014 char buffer[N]; | 1014 char buffer[N]; |
| 1015 TCMalloc_Printer printer(buffer, N); | 1015 TCMalloc_Printer printer(buffer, N); |
| 1016 printer.printf("tcmalloc: large alloc %"PRIu64" bytes == %p @ ", | 1016 printer.printf("tcmalloc: large alloc %" PRIu64 " bytes == %p @ ", |
| 1017 static_cast<uint64>(num_pages) << kPageShift, | 1017 static_cast<uint64>(num_pages) << kPageShift, |
| 1018 result); | 1018 result); |
| 1019 for (int i = 0; i < stack.depth; i++) { | 1019 for (int i = 0; i < stack.depth; i++) { |
| 1020 printer.printf(" %p", stack.stack[i]); | 1020 printer.printf(" %p", stack.stack[i]); |
| 1021 } | 1021 } |
| 1022 printer.printf("\n"); | 1022 printer.printf("\n"); |
| 1023 write(STDERR_FILENO, buffer, strlen(buffer)); | 1023 write(STDERR_FILENO, buffer, strlen(buffer)); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 inline void* cpp_alloc(size_t size, bool nothrow); | 1026 inline void* cpp_alloc(size_t size, bool nothrow); |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 *mark = ~allocated_mark; // Distinctively not allocated. | 1871 *mark = ~allocated_mark; // Distinctively not allocated. |
| 1872 } | 1872 } |
| 1873 | 1873 |
| 1874 static void MarkAllocatedRegion(void* ptr) { | 1874 static void MarkAllocatedRegion(void* ptr) { |
| 1875 if (ptr == NULL) return; | 1875 if (ptr == NULL) return; |
| 1876 MarkType* mark = GetMarkLocation(ptr); | 1876 MarkType* mark = GetMarkLocation(ptr); |
| 1877 *mark = GetMarkValue(ptr, mark); | 1877 *mark = GetMarkValue(ptr, mark); |
| 1878 } | 1878 } |
| 1879 | 1879 |
| 1880 #endif // TCMALLOC_VALIDATION | 1880 #endif // TCMALLOC_VALIDATION |
| OLD | NEW |