OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
Alexander Potapenko
2012/08/17 17:25:48
Please don't change the year (see letter from Mark
bbudge
2012/08/17 17:28:28
Done.
| |
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 #ifndef BASE_DEBUG_LEAK_ANNOTATIONS_H_ | 5 #ifndef BASE_DEBUG_LEAK_ANNOTATIONS_H_ |
6 #define BASE_DEBUG_LEAK_ANNOTATIONS_H_ | 6 #define BASE_DEBUG_LEAK_ANNOTATIONS_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_HEAPCHECKER) | 10 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_NACL) && \ |
11 defined(USE_HEAPCHECKER) | |
11 | 12 |
12 #include "third_party/tcmalloc/chromium/src/gperftools/heap-checker.h" | 13 #include "third_party/tcmalloc/chromium/src/gperftools/heap-checker.h" |
13 | 14 |
14 // Annotate a program scope as having memory leaks. Tcmalloc's heap leak | 15 // Annotate a program scope as having memory leaks. Tcmalloc's heap leak |
15 // checker will ignore them. Note that these annotations may mask real bugs | 16 // checker will ignore them. Note that these annotations may mask real bugs |
16 // and should not be used in the production code. | 17 // and should not be used in the production code. |
17 #define ANNOTATE_SCOPED_MEMORY_LEAK \ | 18 #define ANNOTATE_SCOPED_MEMORY_LEAK \ |
18 HeapLeakChecker::Disabler heap_leak_checker_disabler | 19 HeapLeakChecker::Disabler heap_leak_checker_disabler |
19 | 20 |
20 // Annotate an object pointer as referencing a leaky object. This object and all | 21 // Annotate an object pointer as referencing a leaky object. This object and all |
21 // the heap objects referenced by it will be ignored by the heap checker. | 22 // the heap objects referenced by it will be ignored by the heap checker. |
22 // | 23 // |
23 // X should be referencing an active allocated object. If it is not, the | 24 // X should be referencing an active allocated object. If it is not, the |
24 // annotation will be ignored. | 25 // annotation will be ignored. |
25 // No object should be annotated with ANNOTATE_SCOPED_MEMORY_LEAK twice. | 26 // No object should be annotated with ANNOTATE_SCOPED_MEMORY_LEAK twice. |
26 // Once an object is annotated with ANNOTATE_SCOPED_MEMORY_LEAK, it cannot be | 27 // Once an object is annotated with ANNOTATE_SCOPED_MEMORY_LEAK, it cannot be |
27 // deleted. | 28 // deleted. |
28 #define ANNOTATE_LEAKING_OBJECT_PTR(X) \ | 29 #define ANNOTATE_LEAKING_OBJECT_PTR(X) \ |
29 HeapLeakChecker::IgnoreObject(X) | 30 HeapLeakChecker::IgnoreObject(X) |
30 | 31 |
31 #else | 32 #else |
32 | 33 |
33 // If tcmalloc is not used, the annotations should be no-ops. | 34 // If tcmalloc is not used, the annotations should be no-ops. |
34 #define ANNOTATE_SCOPED_MEMORY_LEAK ((void)0) | 35 #define ANNOTATE_SCOPED_MEMORY_LEAK ((void)0) |
35 #define ANNOTATE_LEAKING_OBJECT_PTR(X) ((void)0) | 36 #define ANNOTATE_LEAKING_OBJECT_PTR(X) ((void)0) |
36 | 37 |
37 #endif | 38 #endif |
38 | 39 |
39 #endif // BASE_DEBUG_LEAK_ANNOTATIONS_H_ | 40 #endif // BASE_DEBUG_LEAK_ANNOTATIONS_H_ |
OLD | NEW |