~drizzle-trunk/drizzle/development

641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
1
/*****************************************************************************
2
3
Copyright (c) 1994, 2009, 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., 59 Temple
15
Place, Suite 330, Boston, MA 02111-1307 USA
16
17
*****************************************************************************/
18
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
19
/********************************************************************//**
20
@file include/mem0dbg.ic
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
21
The memory management: the debug code. This is not an independent
22
compilation module but is included in mem0mem.*.
23
24
Created 6/8/1994 Heikki Tuuri
25
*************************************************************************/
26
27
#ifdef UNIV_MEM_DEBUG
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
28
# ifndef UNIV_HOTBACKUP
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
29
extern mutex_t	mem_hash_mutex;
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
30
# endif /* !UNIV_HOTBACKUP */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
31
extern ulint	mem_current_allocated_memory;
32
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
33
/******************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
34
Initializes an allocated memory field in the debug version. */
35
UNIV_INTERN
36
void
37
mem_field_init(
38
/*===========*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
39
	byte*	buf,	/*!< in: memory field */
40
	ulint	n);	/*!< in: how many bytes the user requested */
41
/******************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
42
Erases an allocated memory field in the debug version. */
43
UNIV_INTERN
44
void
45
mem_field_erase(
46
/*============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
47
	byte*	buf,	/*!< in: memory field */
48
	ulint	n);	/*!< in: how many bytes the user requested */
49
/***************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
50
Initializes a buffer to a random combination of hex BA and BE.
51
Used to initialize allocated memory. */
52
UNIV_INTERN
53
void
54
mem_init_buf(
55
/*=========*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
56
	byte*	buf,	/*!< in: pointer to buffer */
57
	ulint	 n);	 /*!< in: length of buffer */
58
/***************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
59
Initializes a buffer to a random combination of hex DE and AD.
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
60
Used to erase freed memory. */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
61
UNIV_INTERN
62
void
63
mem_erase_buf(
64
/*==========*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
65
	byte*	buf,	/*!< in: pointer to buffer */
66
	ulint	n);	/*!< in: length of buffer */
67
/***************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
68
Inserts a created memory heap to the hash table of
69
current allocated memory heaps.
70
Initializes the hash table when first called. */
71
UNIV_INTERN
72
void
73
mem_hash_insert(
74
/*============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
75
	mem_heap_t*	heap,	   /*!< in: the created heap */
76
	const char*	file_name, /*!< in: file name of creation */
77
	ulint		line);	   /*!< in: line where created */
78
/***************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
79
Removes a memory heap (which is going to be freed by the caller)
80
from the list of live memory heaps. Returns the size of the heap
81
in terms of how much memory in bytes was allocated for the user of
82
the heap (not the total space occupied by the heap).
83
Also validates the heap.
84
NOTE: This function does not free the storage occupied by the
85
heap itself, only the node in the list of heaps. */
86
UNIV_INTERN
87
void
88
mem_hash_remove(
89
/*============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
90
	mem_heap_t*	heap,	   /*!< in: the heap to be freed */
91
	const char*	file_name, /*!< in: file name of freeing */
92
	ulint		line);	   /*!< in: line where freed */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
93
94
95
void
96
mem_field_header_set_len(byte* field, ulint len);
97
98
ulint
99
mem_field_header_get_len(byte* field);
100
101
void
102
mem_field_header_set_check(byte* field, ulint check);
103
104
ulint
105
mem_field_header_get_check(byte* field);
106
107
void
108
mem_field_trailer_set_check(byte* field, ulint check);
109
110
ulint
111
mem_field_trailer_get_check(byte* field);
112
#endif /* UNIV_MEM_DEBUG */