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 <limits.h> |
5 #include <malloc.h> | 6 #include <malloc.h> |
6 #include <new.h> | 7 #include <new.h> |
7 #include <windows.h> | 8 #include <windows.h> |
8 | 9 #include <stddef.h> |
9 #include "base/basictypes.h" | |
10 | 10 |
11 // This shim make it possible to perform additional checks on allocations | 11 // This shim make it possible to perform additional checks on allocations |
12 // before passing them to the Heap functions. | 12 // before passing them to the Heap functions. |
13 | 13 |
14 // Heap functions are stripped from libcmt.lib using the prep_libc.py | 14 // Heap functions are stripped from libcmt.lib using the prep_libc.py |
15 // for each object file stripped, we re-implement them here to allow us to | 15 // for each object file stripped, we re-implement them here to allow us to |
16 // perform additional checks: | 16 // perform additional checks: |
17 // 1. Enforcing the maximum size that can be allocated to 2Gb. | 17 // 1. Enforcing the maximum size that can be allocated to 2Gb. |
18 // 2. Calling new_handler if malloc fails. | 18 // 2. Calling new_handler if malloc fails. |
19 | 19 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 void _free_dbg(void* ptr, int) { | 313 void _free_dbg(void* ptr, int) { |
314 free(ptr); | 314 free(ptr); |
315 } | 315 } |
316 | 316 |
317 void* _calloc_dbg(size_t n, size_t size, int, const char*, int) { | 317 void* _calloc_dbg(size_t n, size_t size, int, const char*, int) { |
318 return calloc(n, size); | 318 return calloc(n, size); |
319 } | 319 } |
320 #endif // NDEBUG | 320 #endif // NDEBUG |
321 | 321 |
322 } // extern C | 322 } // extern C |
OLD | NEW |