drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
mem0dbg.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (C) 1994, 2010, Innobase Oy. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15St, Fifth Floor, Boston, MA 02110-1301 USA
16
17*****************************************************************************/
18
19/**************************************************/
26
27/* In the debug version each allocated field is surrounded with
28check fields whose sizes are given below */
29
30#pragma once
31#ifdef UNIV_MEM_DEBUG
32# ifndef UNIV_HOTBACKUP
33/* The mutex which protects in the debug version the hash table
34containing the list of live memory heaps, and also the global
35variables in mem0dbg.c. */
36extern mutex_t mem_hash_mutex;
37# endif /* !UNIV_HOTBACKUP */
38
39#define MEM_FIELD_HEADER_SIZE ut_calc_align(2 * sizeof(ulint),\
40 UNIV_MEM_ALIGNMENT)
41#define MEM_FIELD_TRAILER_SIZE sizeof(ulint)
42#else
43#define MEM_FIELD_HEADER_SIZE 0
44#endif
45
46
47/* Space needed when allocating for a user a field of
48length N. The space is allocated only in multiples of
49UNIV_MEM_ALIGNMENT. In the debug version there are also
50check fields at the both ends of the field. */
51#ifdef UNIV_MEM_DEBUG
52#define MEM_SPACE_NEEDED(N) ut_calc_align((N) + MEM_FIELD_HEADER_SIZE\
53 + MEM_FIELD_TRAILER_SIZE, UNIV_MEM_ALIGNMENT)
54#else
55#define MEM_SPACE_NEEDED(N) ut_calc_align((N), UNIV_MEM_ALIGNMENT)
56#endif
57
58#if defined UNIV_MEM_DEBUG || defined UNIV_DEBUG
59/***************************************************************/
65UNIV_INTERN
66void
67mem_heap_validate_or_print(
68/*=======================*/
69 mem_heap_t* heap,
70 byte* top,
73 ibool print,
76 ibool* error,
77 ulint* us_size,
82 ulint* ph_size,
85 ulint* n_blocks);
88/**************************************************************/
91UNIV_INTERN
92ibool
93mem_heap_validate(
94/*==============*/
95 mem_heap_t* heap);
96#endif /* UNIV_MEM_DEBUG || UNIV_DEBUG */
97#ifdef UNIV_DEBUG
98/**************************************************************/
101UNIV_INTERN
102ibool
103mem_heap_check(
104/*===========*/
105 mem_heap_t* heap);
106#endif /* UNIV_DEBUG */
107#ifdef UNIV_MEM_DEBUG
108/*****************************************************************/
111UNIV_INTERN
112ibool
113mem_all_freed(void);
114/*===============*/
115/*****************************************************************/
118UNIV_INTERN
119ibool
120mem_validate_no_assert(void);
121/*=========================*/
122/************************************************************/
125UNIV_INTERN
126ibool
127mem_validate(void);
128/*===============*/
129#endif /* UNIV_MEM_DEBUG */
130/************************************************************/
133UNIV_INTERN
134void
136/*===================*/
137 void* ptr);
138/*****************************************************************/
141UNIV_INTERN
142void
143mem_print_info(void);
144/*================*/
145/*****************************************************************/
148UNIV_INTERN
149void
151/*====================*/
UNIV_INTERN void mem_print_new_info(void)
Definition mem0dbg.cc:1047
UNIV_INTERN void mem_print_info(void)
Definition mem0dbg.cc:1036
UNIV_INTERN void mem_analyze_corruption(void *ptr)
Definition mem0dbg.cc:822
#define mutex_t
Definition sync0types.h:31