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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 ATTRIBUTE_SECTION(google_malloc); | 262 ATTRIBUTE_SECTION(google_malloc); |
263 | 263 |
264 // Some non-standard extensions that we support. | 264 // Some non-standard extensions that we support. |
265 | 265 |
266 // This is equivalent to | 266 // This is equivalent to |
267 // OS X: malloc_size() | 267 // OS X: malloc_size() |
268 // glibc: malloc_usable_size() | 268 // glibc: malloc_usable_size() |
269 // Windows: _msize() | 269 // Windows: _msize() |
270 size_t tc_malloc_size(void* p) __THROW | 270 size_t tc_malloc_size(void* p) __THROW |
271 ATTRIBUTE_SECTION(google_malloc); | 271 ATTRIBUTE_SECTION(google_malloc); |
| 272 |
| 273 void* tc_malloc_skip_new_handler(size_t size) |
| 274 ATTRIBUTE_SECTION(google_malloc); |
272 } // extern "C" | 275 } // extern "C" |
273 | 276 |
274 | 277 |
275 // ----------------------- IMPLEMENTATION ------------------------------- | 278 // ----------------------- IMPLEMENTATION ------------------------------- |
276 | 279 |
277 static int tc_new_mode = 0; // See tc_set_new_mode(). | 280 static int tc_new_mode = 0; // See tc_set_new_mode(). |
278 | 281 |
279 // Routines such as free() and realloc() catch some erroneous pointers | 282 // Routines such as free() and realloc() catch some erroneous pointers |
280 // passed to them, and invoke the below when they do. (An erroneous pointer | 283 // passed to them, and invoke the below when they do. (An erroneous pointer |
281 // won't be caught if it's within a valid span or a stale span for which | 284 // won't be caught if it's within a valid span or a stale span for which |
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1885 *mark = ~allocated_mark; // Distinctively not allocated. | 1888 *mark = ~allocated_mark; // Distinctively not allocated. |
1886 } | 1889 } |
1887 | 1890 |
1888 static void MarkAllocatedRegion(void* ptr) { | 1891 static void MarkAllocatedRegion(void* ptr) { |
1889 if (ptr == NULL) return; | 1892 if (ptr == NULL) return; |
1890 MarkType* mark = GetMarkLocation(ptr); | 1893 MarkType* mark = GetMarkLocation(ptr); |
1891 *mark = GetMarkValue(ptr, mark); | 1894 *mark = GetMarkValue(ptr, mark); |
1892 } | 1895 } |
1893 | 1896 |
1894 #endif // TCMALLOC_VALIDATION | 1897 #endif // TCMALLOC_VALIDATION |
OLD | NEW |