~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2009-02-27 21:38:40 UTC
  • Revision ID: brian@tangent.org-20090227213840-r9hq3sfk8d8qrg72
Code cleanup in signal_handler.cc

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
 
1
/************************************************************************
21
2
The memory management: the debug code. This is not an independent
22
3
compilation module but is included in mem0mem.*.
23
4
 
 
5
(c) 1994, 1995 Innobase Oy
 
6
 
24
7
Created 6/8/1994 Heikki Tuuri
25
8
*************************************************************************/
26
9
 
27
10
#ifdef UNIV_MEM_DEBUG
28
 
# ifndef UNIV_HOTBACKUP
29
11
extern mutex_t  mem_hash_mutex;
30
 
# endif /* !UNIV_HOTBACKUP */
31
12
extern ulint    mem_current_allocated_memory;
32
13
 
33
 
/******************************************************************//**
 
14
/**********************************************************************
34
15
Initializes an allocated memory field in the debug version. */
35
16
UNIV_INTERN
36
17
void
37
18
mem_field_init(
38
19
/*===========*/
39
 
        byte*   buf,    /*!< in: memory field */
40
 
        ulint   n);     /*!< in: how many bytes the user requested */
41
 
/******************************************************************//**
 
20
        byte*   buf,    /* in: memory field */
 
21
        ulint   n);     /* in: how many bytes the user requested */
 
22
/**********************************************************************
42
23
Erases an allocated memory field in the debug version. */
43
24
UNIV_INTERN
44
25
void
45
26
mem_field_erase(
46
27
/*============*/
47
 
        byte*   buf,    /*!< in: memory field */
48
 
        ulint   n);     /*!< in: how many bytes the user requested */
49
 
/***************************************************************//**
 
28
        byte*   buf,    /* in: memory field */
 
29
        ulint   n);     /* in: how many bytes the user requested */
 
30
/*******************************************************************
50
31
Initializes a buffer to a random combination of hex BA and BE.
51
32
Used to initialize allocated memory. */
52
33
UNIV_INTERN
53
34
void
54
35
mem_init_buf(
55
36
/*=========*/
56
 
        byte*   buf,    /*!< in: pointer to buffer */
57
 
        ulint    n);     /*!< in: length of buffer */
58
 
/***************************************************************//**
 
37
        byte*   buf,    /* in: pointer to buffer */
 
38
        ulint    n);     /* in: length of buffer */
 
39
/*******************************************************************
59
40
Initializes a buffer to a random combination of hex DE and AD.
60
 
Used to erase freed memory. */
 
41
Used to erase freed memory.*/
61
42
UNIV_INTERN
62
43
void
63
44
mem_erase_buf(
64
45
/*==========*/
65
 
        byte*   buf,    /*!< in: pointer to buffer */
66
 
        ulint   n);     /*!< in: length of buffer */
67
 
/***************************************************************//**
 
46
        byte*   buf,    /* in: pointer to buffer */
 
47
        ulint    n);     /* in: length of buffer */
 
48
/*******************************************************************
68
49
Inserts a created memory heap to the hash table of
69
50
current allocated memory heaps.
70
51
Initializes the hash table when first called. */
72
53
void
73
54
mem_hash_insert(
74
55
/*============*/
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
 
/***************************************************************//**
 
56
        mem_heap_t*     heap,      /* in: the created heap */
 
57
        const char*     file_name, /* in: file name of creation */
 
58
        ulint           line);     /* in: line where created */
 
59
/*******************************************************************
79
60
Removes a memory heap (which is going to be freed by the caller)
80
61
from the list of live memory heaps. Returns the size of the heap
81
62
in terms of how much memory in bytes was allocated for the user of
87
68
void
88
69
mem_hash_remove(
89
70
/*============*/
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 */
 
71
        mem_heap_t*     heap,      /* in: the heap to be freed */
 
72
        const char*     file_name, /* in: file name of freeing */
 
73
        ulint           line);     /* in: line where freed */
93
74
 
94
75
 
95
76
void