Axe.Lua Memory leak

BlitzMax Forums/BlitzMax Programming/Axe.Lua Memory leak

billykater(Posted 2006) [#1]
Import axe.lua

Global lua:Byte Ptr

lua = luaL_newstate()
lua_createtable(lua)

While Not KeyHit(1)
Wend

Uses half of my memory (which is about 850mb).
With lua_newtable it uses all of my memory but it is only a wrapper function for lua_createtable.
Without lua_createtable() it works without any memory leaks. Is anybody experiencing similar problems?


Ragz(Posted 2006) [#2]
I think I am, lua_newtable seems to cause a huge load time for me, but only seems noticable when I have preloaded some images.

Although that example uses a huge amount of memory without any preloading :O


teamonkey(Posted 2006) [#3]
This is a bug in the axe.lua module, by the looks.

lua_createtable should have three parameters, not one. The last two control the size of the table and I guess garbage is being pushed on to them at the moment, which is very dangerous.

For a fix, find lua.bmx in the module directory and change the line
Function lua_createtable(lua_state:Byte Ptr)

to
Function lua_createtable(lua_state:Byte Ptr, narr:Int, nrec:Int)


Then find the function
Function lua_newtable(ls@ Ptr)
    lua_createtable(ls)
End Function

And change it to:
Function lua_newtable(ls@ Ptr)
    lua_createtable(ls, 0, 0)
End Function


Then recompile the modules.


Ragz(Posted 2006) [#4]
Ah! I was just this hour trying to use the function and wondered why it had only 1 perameter. Recompiling the module is nothing more than 'Build' is it?

EDIT: Guess not, I have no idea how to recompile modules :S


skidracer(Posted 2006) [#5]
Thanks teamonkey!

Ragz, try syncmods axe.lua for latest version.


billykater(Posted 2006) [#6]
@Ragz
For windows
# Download and install http://prdownloads.sourceforge.net/mingw/MinGW-3.1.0-1.exe?download
# Edit your PATH environment to include the MinGW/bin
# Create a MINGW environment variable that points to the MinGW root directory
#Click Rebuild All Modules in MaxIDE

seems they have already fixed it