~drizzle-trunk/drizzle/development

641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
1
/*****************************************************************************
2
1819.5.221 by vasil
Merge Revision revid:svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6749 from MySQL InnoDB
3
Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
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
1802.10.2 by Monty Taylor
Update all of the copyright headers to include the correct address.
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
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
28
extern ulint	mem_current_allocated_memory;
29
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
30
/******************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
31
Initializes an allocated memory field in the debug version. */
32
UNIV_INTERN
33
void
34
mem_field_init(
35
/*===========*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
36
	byte*	buf,	/*!< in: memory field */
37
	ulint	n);	/*!< in: how many bytes the user requested */
38
/******************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
39
Erases an allocated memory field in the debug version. */
40
UNIV_INTERN
41
void
42
mem_field_erase(
43
/*============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
44
	byte*	buf,	/*!< in: memory field */
45
	ulint	n);	/*!< in: how many bytes the user requested */
46
/***************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
47
Initializes a buffer to a random combination of hex BA and BE.
48
Used to initialize allocated memory. */
49
UNIV_INTERN
50
void
51
mem_init_buf(
52
/*=========*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
53
	byte*	buf,	/*!< in: pointer to buffer */
54
	ulint	 n);	 /*!< in: length of buffer */
55
/***************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
56
Initializes a buffer to a random combination of hex DE and AD.
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
57
Used to erase freed memory. */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
58
UNIV_INTERN
59
void
60
mem_erase_buf(
61
/*==========*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
62
	byte*	buf,	/*!< in: pointer to buffer */
63
	ulint	n);	/*!< in: length of buffer */
64
/***************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
65
Inserts a created memory heap to the hash table of
66
current allocated memory heaps.
67
Initializes the hash table when first called. */
68
UNIV_INTERN
69
void
70
mem_hash_insert(
71
/*============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
72
	mem_heap_t*	heap,	   /*!< in: the created heap */
73
	const char*	file_name, /*!< in: file name of creation */
74
	ulint		line);	   /*!< in: line where created */
75
/***************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
76
Removes a memory heap (which is going to be freed by the caller)
77
from the list of live memory heaps. Returns the size of the heap
78
in terms of how much memory in bytes was allocated for the user of
79
the heap (not the total space occupied by the heap).
80
Also validates the heap.
81
NOTE: This function does not free the storage occupied by the
82
heap itself, only the node in the list of heaps. */
83
UNIV_INTERN
84
void
85
mem_hash_remove(
86
/*============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
87
	mem_heap_t*	heap,	   /*!< in: the heap to be freed */
88
	const char*	file_name, /*!< in: file name of freeing */
89
	ulint		line);	   /*!< in: line where freed */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
90
91
92
void
93
mem_field_header_set_len(byte* field, ulint len);
94
95
ulint
96
mem_field_header_get_len(byte* field);
97
98
void
99
mem_field_header_set_check(byte* field, ulint check);
100
101
ulint
102
mem_field_header_get_check(byte* field);
103
104
void
105
mem_field_trailer_set_check(byte* field, ulint check);
106
107
ulint
108
mem_field_trailer_get_check(byte* field);
109
#endif /* UNIV_MEM_DEBUG */