~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/mem0dbg.h

  • Committer: Monty Taylor
  • Date: 2008-12-06 22:41:03 UTC
  • mto: (656.1.7 devel)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: monty@inaugust.com-20081206224103-jdouqwt9hb0f01y1
Moved non-working tests into broken suite for easier running of working tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (C) 1994, 2010, Innobase Oy. 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., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
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.* !
23
4
 
 
5
(c) 1994, 1995 Innobase Oy
 
6
 
24
7
Created 6/9/1994 Heikki Tuuri
25
8
*******************************************************/
26
9
 
28
11
check fields whose sizes are given below */
29
12
 
30
13
#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.c. */
35
 
extern mutex_t  mem_hash_mutex;
36
 
# endif /* !UNIV_HOTBACKUP */
37
 
 
38
14
#define MEM_FIELD_HEADER_SIZE   ut_calc_align(2 * sizeof(ulint),\
39
15
                                                UNIV_MEM_ALIGNMENT)
40
16
#define MEM_FIELD_TRAILER_SIZE  sizeof(ulint)
55
31
#endif
56
32
 
57
33
#if defined UNIV_MEM_DEBUG || defined UNIV_DEBUG
58
 
/***************************************************************//**
 
34
/*******************************************************************
59
35
Checks a memory heap for consistency and prints the contents if requested.
60
36
Outputs the sum of sizes of buffers given to the user (only in
61
37
the debug version), the physical size of the heap and the number of
65
41
void
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.
89
 
@return TRUE if ok */
 
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. */
90
65
UNIV_INTERN
91
66
ibool
92
67
mem_heap_validate(
93
68
/*==============*/
94
 
        mem_heap_t*   heap);    /*!< in: memory heap */
 
69
                                /* out: TRUE if ok */
 
70
        mem_heap_t*   heap);    /* in: memory heap */
95
71
#endif /* UNIV_MEM_DEBUG || UNIV_DEBUG */
96
72
#ifdef UNIV_DEBUG
97
 
/**************************************************************//**
98
 
Checks that an object is a memory heap (or a block of it)
99
 
@return TRUE if ok */
 
73
/******************************************************************
 
74
Checks that an object is a memory heap (or a block of it) */
100
75
UNIV_INTERN
101
76
ibool
102
77
mem_heap_check(
103
78
/*===========*/
104
 
        mem_heap_t*   heap);    /*!< in: memory heap */
 
79
                                /* out: TRUE if ok */
 
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. */
110
85
UNIV_INTERN
111
86
ibool
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 */
117
92
UNIV_INTERN
118
93
ibool
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 */
124
99
UNIV_INTERN
125
100
ibool
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. */
132
108
UNIV_INTERN
133
109
void
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. */
140
116
UNIV_INTERN
141
117
void
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. */
147
123
UNIV_INTERN