lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Hello all. I am running an embedded lua interpreter in a 
> limited-memory environment. I have found that, after running 
> certain scripts, I run out of memory. I am able to track all 
> allocations on the system, but this only tells me that the 
> memory was allocated by luaM_realloc(). Is there any way to 
> get Lua to tell me what it is using each allocation for? Any 
> suggestions?
> 
> Eric

The LuaState distribution has this built into it.

http://workspacewhiz.com/Other/LuaState/LuaState.html

See the section Memory Allocators of the above page.  The name of the
allocation is passed into every allocation, and from there, you can keep
track of it.  This is accomplished through the macros, luaM_setname()
and luaM_setnameif() in the Lua code (which don't exist in the main Lua
distribution).

Josh