feisty meow concerns codebase  2.140
memory_checker.h
Go to the documentation of this file.
1 #ifndef MEMORY_CHECKER_CLASS
2 #define MEMORY_CHECKER_CLASS
3 
4 /*****************************************************************************\
5 * *
6 * Name : memory_checker *
7 * Author : Chris Koeritz *
8 * *
9 *******************************************************************************
10 * Copyright (c) 1998-$now By Author. This program is free software; you can *
11 * redistribute it and/or modify it under the terms of the GNU General Public *
12 * License as published by the Free Software Foundation; either version 2 of *
13 * the License or (at your option) any later version. This is online at: *
14 * http://www.fsf.org/copyleft/gpl.html *
15 * Please send any updates to: fred@gruntose.com *
16 \*****************************************************************************/
17 
18 #include "definitions.h"
19 
20 #ifdef ENABLE_MEMORY_HOOK
21 
22 #include "build_configuration.h"
23 uhh
24 
25 // forward.
26 class allocation_memories;
27 class memory_checker;
28 
30 
31 memory_checker BASIS_EXTERN &program_wide_memories();
33 
38 
40 
51 class memory_checker
52 {
53 public:
54  void construct();
55 
56  void destruct();
57 
59  void disable() { _enabled = false; }
61  void enable() { _enabled = true; }
63  bool enabled() const { return _enabled; }
64 
65  void *provide_memory(size_t size, char *file, int line);
67 
73  int release_memory(void *ptr);
75 
80  char *text_form(bool show_outstanding);
82 
86 private:
87  allocation_memories *_mems;
88  bool _unusable;
89  bool _enabled;
90 };
91 
92 #else // enable memory hook.
93  // this section disables the memory checker entirely.
94  #define program_wide_memories()
95  // define a do nothing macro for the global memory tracker.
96 #endif // enable memory hook.
97 
98 #endif // outer guard.
99 
Contains definitions that control how libraries and programs are built.
Constants and objects used throughout HOOPLE.
#define program_wide_memories()