#include "lprefix.h"
#include <stddef.h>
#include "lua.h"
#include "ldebug.h"
#include "ldo.h"
#include "lgc.h"
#include "lmem.h"
#include "lobject.h"
#include "lstate.h"
Go to the source code of this file.
Macros | |
#define | lmem_c |
#define | LUA_CORE |
#define | firsttry(g, block, os, ns) ((*g->frealloc)(g->ud, block, os, ns)) |
#define | MINSIZEARRAY 4 |
Functions | |
void * | luaM_growaux_ (lua_State *L, void *block, int nelems, int *psize, int size_elems, int limit, const char *what) |
void * | luaM_shrinkvector_ (lua_State *L, void *block, int *size, int final_n, int size_elem) |
l_noret | luaM_toobig (lua_State *L) |
void | luaM_free_ (lua_State *L, void *block, size_t osize) |
static void * | tryagain (lua_State *L, void *block, size_t osize, size_t nsize) |
void * | luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) |
void * | luaM_saferealloc_ (lua_State *L, void *block, size_t osize, size_t nsize) |
void * | luaM_malloc_ (lua_State *L, size_t size, int tag) |
Definition at line 38 of file lmem.cpp.
Referenced by luaM_malloc_(), and luaM_realloc_().
#define MINSIZEARRAY 4 |
Definition at line 76 of file lmem.cpp.
Referenced by luaM_growaux_().
void luaM_free_ | ( | lua_State * | L, |
void * | block, | ||
size_t | osize | ||
) |
Definition at line 132 of file lmem.cpp.
References global_State::frealloc, g, G, global_State::GCdebt, lua_assert, and global_State::ud.
void* luaM_growaux_ | ( | lua_State * | L, |
void * | block, | ||
int | nelems, | ||
int * | psize, | ||
int | size_elems, | ||
int | limit, | ||
const char * | what | ||
) |
Definition at line 79 of file lmem.cpp.
References block(), cast_sizet, lua_assert, luaG_runerror(), luaM_saferealloc_(), MINSIZEARRAY, utf8::size(), and unlikely.
void* luaM_malloc_ | ( | lua_State * | L, |
size_t | size, | ||
int | tag | ||
) |
Definition at line 188 of file lmem.cpp.
References firsttry, g, G, global_State::GCdebt, luaM_error, utf8::size(), tryagain(), and unlikely.
void* luaM_realloc_ | ( | lua_State * | L, |
void * | block, | ||
size_t | osize, | ||
size_t | nsize | ||
) |
Definition at line 162 of file lmem.cpp.
References firsttry, g, G, global_State::GCdebt, lua_assert, tryagain(), and unlikely.
Referenced by luaM_saferealloc_().
void* luaM_saferealloc_ | ( | lua_State * | L, |
void * | block, | ||
size_t | osize, | ||
size_t | nsize | ||
) |
Definition at line 179 of file lmem.cpp.
References luaM_error, luaM_realloc_(), and unlikely.
Referenced by luaM_growaux_(), and luaM_shrinkvector_().
void* luaM_shrinkvector_ | ( | lua_State * | L, |
void * | block, | ||
int * | size, | ||
int | final_n, | ||
int | size_elem | ||
) |
Definition at line 110 of file lmem.cpp.
References cast_sizet, lua_assert, and luaM_saferealloc_().
Definition at line 124 of file lmem.cpp.
References luaG_runerror().
Referenced by luaS_newlstr(), and luaS_newudata().
|
static |
Definition at line 146 of file lmem.cpp.
References block(), global_State::frealloc, g, G, luaC_fullgc(), global_State::nilvalue, ttisnil, and global_State::ud.
Referenced by luaM_malloc_(), and luaM_realloc_().