InnoDB Plugin  1.0
mem0dbg.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1994, 2010, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
27 /* In the debug version each allocated field is surrounded with
28 check fields whose sizes are given below */
29 
30 #ifdef UNIV_MEM_DEBUG
31 # ifndef UNIV_HOTBACKUP
32 /* The mutex which protects in the debug version the hash table
33 containing the list of live memory heaps, and also the global
34 variables in mem0dbg.cc. */
35 extern ib_mutex_t mem_hash_mutex;
36 # endif /* !UNIV_HOTBACKUP */
37 
38 #define MEM_FIELD_HEADER_SIZE ut_calc_align(2 * sizeof(ulint),\
39  UNIV_MEM_ALIGNMENT)
40 #define MEM_FIELD_TRAILER_SIZE sizeof(ulint)
41 #else
42 #define MEM_FIELD_HEADER_SIZE 0
43 #endif
44 
45 
46 /* Space needed when allocating for a user a field of
47 length N. The space is allocated only in multiples of
48 UNIV_MEM_ALIGNMENT. In the debug version there are also
49 check fields at the both ends of the field. */
50 #ifdef UNIV_MEM_DEBUG
51 #define MEM_SPACE_NEEDED(N) ut_calc_align((N) + MEM_FIELD_HEADER_SIZE\
52  + MEM_FIELD_TRAILER_SIZE, UNIV_MEM_ALIGNMENT)
53 #else
54 #define MEM_SPACE_NEEDED(N) ut_calc_align((N), UNIV_MEM_ALIGNMENT)
55 #endif
56 
57 #if defined UNIV_MEM_DEBUG || defined UNIV_DEBUG
58 /***************************************************************/
64 UNIV_INTERN
65 void
67 /*=======================*/
68  mem_heap_t* heap,
69  byte* top,
72  ibool print,
75  ibool* error,
76  ulint* us_size,
81  ulint* ph_size,
84  ulint* n_blocks);
87 /**************************************************************/
90 UNIV_INTERN
91 ibool
93 /*==============*/
94  mem_heap_t* heap);
95 #endif /* UNIV_MEM_DEBUG || UNIV_DEBUG */
96 #ifdef UNIV_DEBUG
97 /**************************************************************/
100 UNIV_INTERN
101 ibool
103 /*===========*/
104  mem_heap_t* heap);
105 #endif /* UNIV_DEBUG */
106 #ifdef UNIV_MEM_DEBUG
107 /*****************************************************************/
110 UNIV_INTERN
111 ibool
112 mem_all_freed(void);
113 /*===============*/
114 /*****************************************************************/
117 UNIV_INTERN
118 ibool
119 mem_validate_no_assert(void);
120 /*=========================*/
121 /************************************************************/
124 UNIV_INTERN
125 ibool
126 mem_validate(void);
127 /*===============*/
128 #endif /* UNIV_MEM_DEBUG */
129 /************************************************************/
132 UNIV_INTERN
133 void
135 /*===================*/
136  void* ptr);
137 /*****************************************************************/
140 UNIV_INTERN
141 void
142 mem_print_info(void);
143 /*================*/
144 /*****************************************************************/
147 UNIV_INTERN
148 void
149 mem_print_new_info(void);
150 /*====================*/