You can allocate resources with mmap/malloc and use __gc metamethod to free them so there is no manual cleanup needed. Justin On 31 Jan 2013 13:03, "Petri Häkkinen" <petrih3@xxxxxxxxx> wrote: > Hi, > > I've recently hit the 2GB limit with Legend of Grimrock running on OS X. > > Basically the problem occurs because the game has lots of textures, other > OpenGL resources, audio etc. which get placed into the "LuaJIT friendly" > address space. Afaik, there is no way to control where OpenGL and OpenAL > places the resources in memory. > > I think I can deal with the problem in this case by optimizing mem usage > on a general level and moving what I can beyond 2GB, but I'm worried that > in the long run, with the next game project that is much bigger than > Grimrock, the situation will be worse with a lot more assets stamping on > the LuaJIT universe. > > So until LuaJIT 2.1 increases the limit to 4GB, what are the best > practices to workaround the issue? > > Is it possible that in the future (perhaps LuaJIT 3?) the address space > limitation will be lifted off (perhaps optionally)? I understand this does > not affect pure Lua applications that much but with projects allocating > lots of resources from various sources, it can become a nightmare to track > where memory allocations go in the address space. > > Best Regards, > > Petri Häkkinen > > >