📄 ut0mem.h
字号:
/***********************************************************************Memory primitives(c) 1994, 1995 Innobase OyCreated 5/30/1994 Heikki Tuuri************************************************************************/#ifndef ut0mem_h#define ut0mem_h#include "univ.i"#include <string.h>#include <stdlib.h>/* The total amount of memory currently allocated from the OS with malloc */extern ulint ut_total_allocated_memory;UNIV_INLINEvoid*ut_memcpy(void* dest, const void* sour, ulint n);UNIV_INLINEvoid*ut_memmove(void* dest, const void* sour, ulint n);UNIV_INLINEintut_memcmp(const void* str1, const void* str2, ulint n);/**************************************************************************Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO isdefined and set_to_zero is TRUE. */void*ut_malloc_low(/*==========*/ /* out, own: allocated memory */ ulint n, /* in: number of bytes to allocate */ ibool set_to_zero, /* in: TRUE if allocated memory should be set to zero if UNIV_SET_MEM_TO_ZERO is defined */ ibool assert_on_error); /* in: if TRUE, we crash mysqld if the memory cannot be allocated *//**************************************************************************Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO isdefined. */void*ut_malloc(/*======*/ /* out, own: allocated memory */ ulint n); /* in: number of bytes to allocate *//**************************************************************************Tests if malloc of n bytes would succeed. ut_malloc() asserts if memory runsout. It cannot be used if we want to return an error message. Prints tostderr a message if fails. */iboolut_test_malloc(/*===========*/ /* out: TRUE if succeeded */ ulint n); /* in: try to allocate this many bytes *//**************************************************************************Frees a memory bloock allocated with ut_malloc. */voidut_free(/*====*/ void* ptr); /* in, own: memory block *//**************************************************************************Implements realloc. This is needed by /pars/lexyy.c. Otherwise, you should notuse this function because the allocation functions in mem0mem.h are therecommended ones in InnoDB.man realloc in Linux, 2004: realloc() changes the size of the memory block pointed to by ptr to size bytes. The contents will be unchanged to the minimum of the old and new sizes; newly allocated mem
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -