OLD | NEW |
1 // Copyright (c) 2011, Google Inc. | 1 // Copyright (c) 2011, 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // For windows, there are two ways to get tcmalloc. If we're | 62 // For windows, there are two ways to get tcmalloc. If we're |
63 // patching, then src/windows/patch_function.cc will do the necessary | 63 // patching, then src/windows/patch_function.cc will do the necessary |
64 // overriding here. Otherwise, we doing the 'redefine' trick, where | 64 // overriding here. Otherwise, we doing the 'redefine' trick, where |
65 // we remove malloc/new/etc from mscvcrt.dll, and just need to define | 65 // we remove malloc/new/etc from mscvcrt.dll, and just need to define |
66 // them now. | 66 // them now. |
67 #if defined(_WIN32) && defined(WIN32_DO_PATCHING) | 67 #if defined(_WIN32) && defined(WIN32_DO_PATCHING) |
68 void PatchWindowsFunctions(); // in src/windows/patch_function.cc | 68 void PatchWindowsFunctions(); // in src/windows/patch_function.cc |
69 static void ReplaceSystemAlloc() { PatchWindowsFunctions(); } | 69 static void ReplaceSystemAlloc() { PatchWindowsFunctions(); } |
70 | 70 |
71 #elif defined(_WIN32) && !defined(WIN32_DO_PATCHING) | 71 #elif defined(_WIN32) && !defined(WIN32_DO_PATCHING) |
| 72 // On Windows we define the allocation functions in |
| 73 // base/allocator/allocator_shim.cc, so we can't include |
| 74 // libc_override_redefine.h here. |
| 75 // We also need to define ReplaceSystemAlloc() somewhere. |
| 76 #if 0 |
72 #include "libc_override_redefine.h" | 77 #include "libc_override_redefine.h" |
| 78 #else |
| 79 static void ReplaceSystemAlloc() { } |
| 80 #endif |
73 | 81 |
74 #elif defined(__APPLE__) | 82 #elif defined(__APPLE__) |
75 #include "libc_override_osx.h" | 83 #include "libc_override_osx.h" |
76 | 84 |
77 #elif defined(__GLIBC__) | 85 #elif defined(__GLIBC__) |
78 #include "libc_override_glibc.h" | 86 #include "libc_override_glibc.h" |
79 | 87 |
80 // Not all gcc systems necessarily support weak symbols, but all the | 88 // Not all gcc systems necessarily support weak symbols, but all the |
81 // ones I know of do, so for now just assume they all do. | 89 // ones I know of do, so for now just assume they all do. |
82 #elif defined(__GNUC__) | 90 #elif defined(__GNUC__) |
83 #include "libc_override_gcc_and_weak.h" | 91 #include "libc_override_gcc_and_weak.h" |
84 | 92 |
85 #else | 93 #else |
86 #error Need to add support for your libc/OS here | 94 #error Need to add support for your libc/OS here |
87 | 95 |
88 #endif | 96 #endif |
89 | 97 |
90 #endif // TCMALLOC_LIBC_OVERRIDE_INL_H_ | 98 #endif // TCMALLOC_LIBC_OVERRIDE_INL_H_ |
OLD | NEW |