| 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 27 matching lines...) Expand all Loading... |
| 38 // | 38 // |
| 39 // This file must be the last library any binary links against. | 39 // This file must be the last library any binary links against. |
| 40 // Otherwise, the heap checker may not be able to run early enough to | 40 // Otherwise, the heap checker may not be able to run early enough to |
| 41 // catalog all the global objects in your program. If this happens, | 41 // catalog all the global objects in your program. If this happens, |
| 42 // and later in the program you allocate memory and have one of these | 42 // and later in the program you allocate memory and have one of these |
| 43 // "uncataloged" global objects point to it, the heap checker will | 43 // "uncataloged" global objects point to it, the heap checker will |
| 44 // consider that allocation to be a leak, even though it's not (since | 44 // consider that allocation to be a leak, even though it's not (since |
| 45 // the allocated object is reachable from global data and hence "live"). | 45 // the allocated object is reachable from global data and hence "live"). |
| 46 | 46 |
| 47 #include <stdlib.h> // for abort() | 47 #include <stdlib.h> // for abort() |
| 48 #include <google/malloc_extension.h> | 48 #include <gperftools/malloc_extension.h> |
| 49 | 49 |
| 50 // A dummy variable to refer from heap-checker.cc. This is to make | 50 // A dummy variable to refer from heap-checker.cc. This is to make |
| 51 // sure this file is not optimized out by the linker. | 51 // sure this file is not optimized out by the linker. |
| 52 bool heap_leak_checker_bcad_variable; | 52 bool heap_leak_checker_bcad_variable; |
| 53 | 53 |
| 54 extern void HeapLeakChecker_AfterDestructors(); // in heap-checker.cc | 54 extern void HeapLeakChecker_AfterDestructors(); // in heap-checker.cc |
| 55 | 55 |
| 56 // A helper class to ensure that some components of heap leak checking | 56 // A helper class to ensure that some components of heap leak checking |
| 57 // can happen before construction and after destruction | 57 // can happen before construction and after destruction |
| 58 // of all global/static objects. | 58 // of all global/static objects. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 83 private: | 83 private: |
| 84 // Counter of constructions/destructions of objects of this class | 84 // Counter of constructions/destructions of objects of this class |
| 85 // (just in case there are more than one of them). | 85 // (just in case there are more than one of them). |
| 86 static int count_; | 86 static int count_; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 int HeapLeakCheckerGlobalPrePost::count_ = 0; | 89 int HeapLeakCheckerGlobalPrePost::count_ = 0; |
| 90 | 90 |
| 91 // The early-construction/late-destruction global object. | 91 // The early-construction/late-destruction global object. |
| 92 static const HeapLeakCheckerGlobalPrePost heap_leak_checker_global_pre_post; | 92 static const HeapLeakCheckerGlobalPrePost heap_leak_checker_global_pre_post; |
| OLD | NEW |