OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/process_util.h" | 5 #include "base/process_util.h" |
6 | 6 |
7 #include <dirent.h> | 7 #include <dirent.h> |
8 #include <malloc.h> | 8 #include <malloc.h> |
9 #include <sys/time.h> | 9 #include <sys/time.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
738 LOG(FATAL) << "Out of memory, size = " << size; | 738 LOG(FATAL) << "Out of memory, size = " << size; |
739 LOG(FATAL) << "Out of memory."; | 739 LOG(FATAL) << "Out of memory."; |
740 } | 740 } |
741 | 741 |
742 void OnNoMemory() { | 742 void OnNoMemory() { |
743 OnNoMemorySize(0); | 743 OnNoMemorySize(0); |
744 } | 744 } |
745 | 745 |
746 } // namespace | 746 } // namespace |
747 | 747 |
748 #if !defined(OS_ANDROID) && !defined(USE_TCMALLOC) && \ | 748 #if defined(GLIBC) && !defined(USE_TCMALLOC) && \ |
agl
2013/05/20 15:18:22
It's not clear that we don't actually want this ma
Mostyn Bramley-Moore
2013/05/20 20:41:41
I downloaded android-ndk-r8e and inspected platfor
| |
749 !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) && \ | 749 !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) && \ |
750 !defined(THREAD_SANITIZER) | 750 !defined(THREAD_SANITIZER) |
751 | 751 |
752 extern "C" { | 752 extern "C" { |
753 void* __libc_malloc(size_t size); | 753 void* __libc_malloc(size_t size); |
754 void* __libc_realloc(void* ptr, size_t size); | 754 void* __libc_realloc(void* ptr, size_t size); |
755 void* __libc_calloc(size_t nmemb, size_t size); | 755 void* __libc_calloc(size_t nmemb, size_t size); |
756 void* __libc_valloc(size_t size); | 756 void* __libc_valloc(size_t size); |
757 void* __libc_pvalloc(size_t size); | 757 void* __libc_pvalloc(size_t size); |
758 void* __libc_memalign(size_t alignment, size_t size); | 758 void* __libc_memalign(size_t alignment, size_t size); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
819 int posix_memalign(void** ptr, size_t alignment, size_t size) | 819 int posix_memalign(void** ptr, size_t alignment, size_t size) |
820 __attribute__ ((visibility("default"))); | 820 __attribute__ ((visibility("default"))); |
821 | 821 |
822 int posix_memalign(void** ptr, size_t alignment, size_t size) { | 822 int posix_memalign(void** ptr, size_t alignment, size_t size) { |
823 // This will use the safe version of memalign, above. | 823 // This will use the safe version of memalign, above. |
824 *ptr = memalign(alignment, size); | 824 *ptr = memalign(alignment, size); |
825 return 0; | 825 return 0; |
826 } | 826 } |
827 | 827 |
828 } // extern C | 828 } // extern C |
829 #endif // ANDROID, TCMALLOC, *_SANITIZER | 829 #endif // GLIBC, !TCMALLOC, !*_SANITIZER |
830 | 830 |
831 void EnableTerminationOnHeapCorruption() { | 831 void EnableTerminationOnHeapCorruption() { |
832 // On Linux, there nothing to do AFAIK. | 832 // On Linux, there nothing to do AFAIK. |
833 } | 833 } |
834 | 834 |
835 void EnableTerminationOnOutOfMemory() { | 835 void EnableTerminationOnOutOfMemory() { |
836 #if defined(OS_ANDROID) | 836 #if defined(OS_ANDROID) |
837 // Android doesn't support setting a new handler. | 837 // Android doesn't support setting a new handler. |
838 DLOG(WARNING) << "Not feasible."; | 838 DLOG(WARNING) << "Not feasible."; |
839 #else | 839 #else |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
879 int score_len = static_cast<int>(score_str.length()); | 879 int score_len = static_cast<int>(score_str.length()); |
880 return (score_len == file_util::WriteFile(oom_file, | 880 return (score_len == file_util::WriteFile(oom_file, |
881 score_str.c_str(), | 881 score_str.c_str(), |
882 score_len)); | 882 score_len)); |
883 } | 883 } |
884 | 884 |
885 return false; | 885 return false; |
886 } | 886 } |
887 | 887 |
888 } // namespace base | 888 } // namespace base |
OLD | NEW |