1
/************************************************************************
2
The memory management: the debug code. This is not an independent
3
compilation module but is included in mem0mem.*.
5
(c) 1994, 1995 Innobase Oy
7
Created 6/8/1994 Heikki Tuuri
8
*************************************************************************/
11
extern mutex_t mem_hash_mutex;
12
extern ulint mem_current_allocated_memory;
14
/**********************************************************************
15
Initializes an allocated memory field in the debug version. */
20
byte* buf, /* in: memory field */
21
ulint n); /* in: how many bytes the user requested */
22
/**********************************************************************
23
Erases an allocated memory field in the debug version. */
28
byte* buf, /* in: memory field */
29
ulint n); /* in: how many bytes the user requested */
30
/*******************************************************************
31
Initializes a buffer to a random combination of hex BA and BE.
32
Used to initialize allocated memory. */
37
byte* buf, /* in: pointer to buffer */
38
ulint n); /* in: length of buffer */
39
/*******************************************************************
40
Initializes a buffer to a random combination of hex DE and AD.
41
Used to erase freed memory.*/
46
byte* buf, /* in: pointer to buffer */
47
ulint n); /* in: length of buffer */
48
/*******************************************************************
49
Inserts a created memory heap to the hash table of
50
current allocated memory heaps.
51
Initializes the hash table when first called. */
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
/*******************************************************************
60
Removes a memory heap (which is going to be freed by the caller)
61
from the list of live memory heaps. Returns the size of the heap
62
in terms of how much memory in bytes was allocated for the user of
63
the heap (not the total space occupied by the heap).
64
Also validates the heap.
65
NOTE: This function does not free the storage occupied by the
66
heap itself, only the node in the list of heaps. */
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 */
77
mem_field_header_set_len(byte* field, ulint len);
80
mem_field_header_get_len(byte* field);
83
mem_field_header_set_check(byte* field, ulint check);
86
mem_field_header_get_check(byte* field);
89
mem_field_trailer_set_check(byte* field, ulint check);
92
mem_field_trailer_get_check(byte* field);
93
#endif /* UNIV_MEM_DEBUG */