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.ic
21
The memory management: the debug code. This is not an independent
22
compilation module but is included in mem0mem.*.
24
Created 6/8/1994 Heikki Tuuri
25
*************************************************************************/
28
extern ulint mem_current_allocated_memory;
30
/******************************************************************//**
31
Initializes an allocated memory field in the debug version. */
36
byte* buf, /*!< in: memory field */
37
ulint n); /*!< in: how many bytes the user requested */
38
/******************************************************************//**
39
Erases an allocated memory field in the debug version. */
44
byte* buf, /*!< in: memory field */
45
ulint n); /*!< in: how many bytes the user requested */
46
/***************************************************************//**
47
Initializes a buffer to a random combination of hex BA and BE.
48
Used to initialize allocated memory. */
53
byte* buf, /*!< in: pointer to buffer */
54
ulint n); /*!< in: length of buffer */
55
/***************************************************************//**
56
Initializes a buffer to a random combination of hex DE and AD.
57
Used to erase freed memory. */
62
byte* buf, /*!< in: pointer to buffer */
63
ulint n); /*!< in: length of buffer */
64
/***************************************************************//**
65
Inserts a created memory heap to the hash table of
66
current allocated memory heaps.
67
Initializes the hash table when first called. */
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
/***************************************************************//**
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. */
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 */
93
mem_field_header_set_len(byte* field, ulint len);
96
mem_field_header_get_len(byte* field);
99
mem_field_header_set_check(byte* field, ulint check);
102
mem_field_header_get_check(byte* field);
105
mem_field_trailer_set_check(byte* field, ulint check);
108
mem_field_trailer_get_check(byte* field);
109
#endif /* UNIV_MEM_DEBUG */