~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to storage/innodb_plugin/include/mem0dbg.ic

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
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.*.
 
23
 
 
24
Created 6/8/1994 Heikki Tuuri
 
25
*************************************************************************/
 
26
 
 
27
#ifdef UNIV_MEM_DEBUG
 
28
# ifndef UNIV_HOTBACKUP
 
29
extern mutex_t  mem_hash_mutex;
 
30
# endif /* !UNIV_HOTBACKUP */
 
31
extern ulint    mem_current_allocated_memory;
 
32
 
 
33
/******************************************************************//**
 
34
Initializes an allocated memory field in the debug version. */
 
35
UNIV_INTERN
 
36
void
 
37
mem_field_init(
 
38
/*===========*/
 
39
        byte*   buf,    /*!< in: memory field */
 
40
        ulint   n);     /*!< in: how many bytes the user requested */
 
41
/******************************************************************//**
 
42
Erases an allocated memory field in the debug version. */
 
43
UNIV_INTERN
 
44
void
 
45
mem_field_erase(
 
46
/*============*/
 
47
        byte*   buf,    /*!< in: memory field */
 
48
        ulint   n);     /*!< in: how many bytes the user requested */
 
49
/***************************************************************//**
 
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
/*=========*/
 
56
        byte*   buf,    /*!< in: pointer to buffer */
 
57
        ulint    n);     /*!< in: length of buffer */
 
58
/***************************************************************//**
 
59
Initializes a buffer to a random combination of hex DE and AD.
 
60
Used to erase freed memory. */
 
61
UNIV_INTERN
 
62
void
 
63
mem_erase_buf(
 
64
/*==========*/
 
65
        byte*   buf,    /*!< in: pointer to buffer */
 
66
        ulint   n);     /*!< in: length of buffer */
 
67
/***************************************************************//**
 
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
/*============*/
 
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
/***************************************************************//**
 
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
/*============*/
 
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 */
 
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 */