1
/*****************************************************************************
3
Copyright (C) 1994, 2010, Innobase Oy. All Rights Reserved.
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.
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.
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., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
17
*****************************************************************************/
19
/**************************************************//**
20
@file include/mem0dbg.h
1
/******************************************************
21
2
The memory management: the debug code. This is not a compilation module,
22
3
but is included in mem0mem.* !
5
(c) 1994, 1995 Innobase Oy
24
7
Created 6/9/1994 Heikki Tuuri
25
8
*******************************************************/
66
42
mem_heap_validate_or_print(
67
43
/*=======================*/
68
mem_heap_t* heap, /*!< in: memory heap */
69
byte* top, /*!< in: calculate and validate only until
44
mem_heap_t* heap, /* in: memory heap */
45
byte* top, /* in: calculate and validate only until
70
46
this top pointer in the heap is reached,
71
47
if this pointer is NULL, ignored */
72
ibool print, /*!< in: if TRUE, prints the contents
48
ibool print, /* in: if TRUE, prints the contents
73
49
of the heap; works only in
74
50
the debug version */
75
ibool* error, /*!< out: TRUE if error */
76
ulint* us_size,/*!< out: allocated memory
51
ibool* error, /* out: TRUE if error */
52
ulint* us_size,/* out: allocated memory
77
53
(for the user) in the heap,
78
54
if a NULL pointer is passed as this
79
55
argument, it is ignored; in the
80
56
non-debug version this is always -1 */
81
ulint* ph_size,/*!< out: physical size of the heap,
82
if a NULL pointer is passed as this
83
argument, it is ignored */
84
ulint* n_blocks); /*!< out: number of blocks in the heap,
85
if a NULL pointer is passed as this
86
argument, it is ignored */
87
/**************************************************************//**
88
Validates the contents of a memory heap.
57
ulint* ph_size,/* out: physical size of the heap,
58
if a NULL pointer is passed as this
59
argument, it is ignored */
60
ulint* n_blocks); /* out: number of blocks in the heap,
61
if a NULL pointer is passed as this
62
argument, it is ignored */
63
/******************************************************************
64
Validates the contents of a memory heap. */
94
mem_heap_t* heap); /*!< in: memory heap */
70
mem_heap_t* heap); /* in: memory heap */
95
71
#endif /* UNIV_MEM_DEBUG || UNIV_DEBUG */
97
/**************************************************************//**
98
Checks that an object is a memory heap (or a block of it)
73
/******************************************************************
74
Checks that an object is a memory heap (or a block of it) */
104
mem_heap_t* heap); /*!< in: memory heap */
80
mem_heap_t* heap); /* in: memory heap */
105
81
#endif /* UNIV_DEBUG */
106
82
#ifdef UNIV_MEM_DEBUG
107
/*****************************************************************//**
108
TRUE if no memory is currently allocated.
109
@return TRUE if no heaps exist */
83
/*********************************************************************
84
TRUE if no memory is currently allocated. */
112
87
mem_all_freed(void);
113
88
/*===============*/
114
/*****************************************************************//**
115
Validates the dynamic memory
116
@return TRUE if error */
89
/* out: TRUE if no heaps exist */
90
/*********************************************************************
91
Validates the dynamic memory */
119
94
mem_validate_no_assert(void);
120
95
/*=========================*/
121
/************************************************************//**
122
Validates the dynamic memory
123
@return TRUE if ok */
96
/* out: TRUE if error */
97
/****************************************************************
98
Validates the dynamic memory */
126
101
mem_validate(void);
127
102
/*===============*/
103
/* out: TRUE if ok */
128
104
#endif /* UNIV_MEM_DEBUG */
129
/************************************************************//**
105
/****************************************************************
130
106
Tries to find neigboring memory allocation blocks and dumps to stderr
131
107
the neighborhood of a given pointer. */
134
110
mem_analyze_corruption(
135
111
/*===================*/
136
void* ptr); /*!< in: pointer to place of possible corruption */
137
/*****************************************************************//**
112
void* ptr); /* in: pointer to place of possible corruption */
113
/*********************************************************************
138
114
Prints information of dynamic memory usage and currently allocated memory
139
115
heaps or buffers. Can only be used in the debug version. */
142
118
mem_print_info(void);
143
119
/*================*/
144
/*****************************************************************//**
120
/*********************************************************************
145
121
Prints information of dynamic memory usage and currently allocated memory
146
122
heaps or buffers since the last ..._print_info or..._print_new_info. */