MySQL 5.6.14 Source Code Document
|
Go to the source code of this file.
Classes | |
struct | ut_mem_block_t |
Macros | |
#define | UT_MEM_MAGIC_N 1601650166 |
Functions | |
UNIV_INTERN void | ut_mem_init (void) |
UNIV_INTERN void * | ut_malloc_low (ulint n, ibool assert_on_error) |
UNIV_INTERN void | ut_free (void *ptr) |
UNIV_INTERN void * | ut_realloc (void *ptr, ulint size) |
UNIV_INTERN void | ut_free_all_mem (void) |
UNIV_INTERN ulint | ut_strlcpy (char *dst, const char *src, ulint size) |
UNIV_INTERN ulint | ut_strlcpy_rev (char *dst, const char *src, ulint size) |
UNIV_INTERN ulint | ut_strcount (const char *s1, const char *s2) |
char * | ut_str3cat (const char *s1, const char *s2, const char *s3) |
UNIV_INTERN char * | ut_strreplace (const char *str, const char *s1, const char *s2) |
Variables | |
UNIV_INTERN ulint | ut_total_allocated_memory = 0 |
UNIV_INTERN os_fast_mutex_t | ut_list_mutex |
#define UT_MEM_MAGIC_N 1601650166 |
UNIV_INTERN void ut_free | ( | void * | ptr | ) |
UNIV_INTERN void ut_free_all_mem | ( | void | ) |
UNIV_INTERN void* ut_malloc_low | ( | ulint | n, |
ibool | assert_on_error | ||
) |
UNIV_INTERN void ut_mem_init | ( | void | ) |
UNIV_INTERN void* ut_realloc | ( | void * | ptr, |
ulint | size | ||
) |
Implements realloc. This is needed by /pars/lexyy.cc. Otherwise, you should not use this function because the allocation functions in mem0mem.h are the recommended 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- ory will be uninitialized. If ptr is NULL, the call is equivalent to malloc(size); if size is equal to zero, the call is equivalent to free(ptr). Unless ptr is NULL, it must have been returned by an earlier call to malloc(), calloc() or realloc().
RETURN VALUE realloc() returns a pointer to the newly allocated memory, which is suitably aligned for any kind of variable and may be different from ptr, or NULL if the request fails. If size was equal to 0, either NULL or a pointer suitable to be passed to free() is returned. If realloc() fails the original block is left untouched - it is not freed or moved.
ptr | in: pointer to old block or NULL |
size | in: desired size |
Definition at line 273 of file ut0mem.cc.
UNIV_INTERN ulint ut_strcount | ( | const char * | s1, |
const char * | s2 | ||
) |
UNIV_INTERN ulint ut_strlcpy | ( | char * | dst, |
const char * | src, | ||
ulint | size | ||
) |
Copies up to size - 1 characters from the NUL-terminated string src to dst, NUL-terminating the result. Returns strlen(src), so truncation occurred if the return value >= size.
dst | in: destination buffer |
src | in: source buffer |
size | in: size of destination buffer |
Definition at line 367 of file ut0mem.cc.
UNIV_INTERN ulint ut_strlcpy_rev | ( | char * | dst, |
const char * | src, | ||
ulint | size | ||
) |
Like ut_strlcpy, but if src doesn't fit in dst completely, copies the last (size - 1) bytes of src, not the first.
dst | in: destination buffer |
src | in: source buffer |
size | in: size of destination buffer |
Definition at line 391 of file ut0mem.cc.
UNIV_INTERN char* ut_strreplace | ( | const char * | str, |
const char * | s1, | ||
const char * | s2 | ||
) |
Replace every occurrence of s1 in str with s2. Overlapping instances of s1 are only replaced once.
str | in: string to operate on |
s1 | in: string to replace |
s2 | in: string to replace s1 with |
Definition at line 476 of file ut0mem.cc.
UNIV_INTERN os_fast_mutex_t ut_list_mutex |
UNIV_INTERN ulint ut_total_allocated_memory = 0 |
The total amount of memory currently allocated from the operating
system with os_mem_alloc_large() or malloc(). Does not count malloc() if srv_use_sys_malloc is set. Protected by ut_list_mutex.