lua-users home
lua-l archive

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


Hi, Steve.
It's a very good start, but do you know what happens with this occurencies when Lua VM run the garbage collector automatically? Does it collect this unused space before I fill then with some values?

example:

t = alien.table( 5, 5 )
--  do something
for i = 1, 5 do
   t[i] = i * 2
end
-- do something else
for i = 1, 5 do
   t[ 'element'..tostring(i) ] = i * 3
end

The garbage collector could run between the alien.table line and the first for or the second for. Do the memory allocated with alien.table instruction still alocated and assigned to the table t when the first and the second for run?

Thanks,
Marco


On Tue, Jun 16, 2009 at 12:25 PM, steve donovan <steve.j.donovan@gmail.com> wrote:
On Tue, Jun 16, 2009 at 3:33 PM, Marco Antonio
Abreu<mabreu.ti@gmail.com> > My problem starts when I need to load
thousands of data in a table thousands
> of times during an execution.
>
> Some time ago we had talked about an native function to create tables with
> predefined number of elements direct in Lua.

Straightforward to add as an extension. For example. "Alien exposes
the lua_createtable function as alien.table(narray, nhash)"

http://luaforge.net/projects/alien/

steve d.



--
Marco Antonio Abreu
System Analist/Developer