lua-users home
lua-l archive

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

The code

N = 1.0e7
C = {}
for i=1,N do C[i] = i end
for i=1,100*N do
        local a = {1,2,3,4}



problem: when Lua uses lot of memory, the creation of temporary objects can consume all your memory. I think CG should collect the objects fast enough, but it does not. A perfectly OK program can't run because of the amount of garbage to be collected consumes all memory.

I overcome this situation using collectgarbage() options inside the "for", but the performance is severely degraded. (due to the high number of objects GC need to manager, or the manual increase of the number of cycles.)

question: There is some place of Lua source code that I can modify to keep the memory usage as close as possible to 262166.11035156 without doing my program 3x slowly?

Rodrigo Azevedo Moreira da Silva