Last change
on this file since 2274 was
2274,
checked in by ymipsl, 3 years ago
|
Tracking memory leak : release memory statically alocated
YM
|
-
Property svn:executable set to
*
|
File size:
957 bytes
|
Rev | Line | |
---|
[2212] | 1 | #ifndef __XIOS_MEM_CHECKER_HPP__ |
---|
| 2 | #define __XIOS_MEM_CHECKER_HPP__ |
---|
| 3 | |
---|
| 4 | #include <string> |
---|
| 5 | #include <map> |
---|
| 6 | |
---|
| 7 | namespace xios |
---|
| 8 | { |
---|
| 9 | class CMemChecker |
---|
| 10 | { |
---|
| 11 | public: |
---|
| 12 | CMemChecker(const std::string& name); |
---|
| 13 | void suspend(void); |
---|
| 14 | void resume(void); |
---|
| 15 | void reset(void); |
---|
| 16 | double getCumulatedMem(void); |
---|
| 17 | static double getMem(void); |
---|
| 18 | static CMemChecker& get(std::string name); |
---|
| 19 | static std::string getAllCumulatedMem(void) ; |
---|
| 20 | static void disable(void) { enabled_=false ;} |
---|
| 21 | static void enable(void) {enabled_=true ;} |
---|
[2274] | 22 | static void release(void) {allMemChecker_.clear();} |
---|
[2212] | 23 | private: |
---|
| 24 | static void check(void) ; |
---|
| 25 | double cumulatedMem_; |
---|
| 26 | double lastMem_; |
---|
| 27 | bool suspended_; |
---|
| 28 | std::string name_; |
---|
| 29 | |
---|
| 30 | static std::map<std::string,CMemChecker> allMemChecker_; |
---|
| 31 | static CMemChecker dummy_ ; |
---|
| 32 | static bool first_ ; |
---|
| 33 | static bool enabled_ ; |
---|
| 34 | }; |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.