lua-users home
lua-l archive

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


> Will we have/be able to impelent by standard means a function to the
> tune of
>         collect_given_amount_of_ram(mem_kb)     
> whose execution time would only depend on 'mem_kb' and be virtually
> independent of the number of Lua objects?

More or less. First, the meaning of `collect_given_amount_of_ram' is
far from obvious. When the collector is in the mark phase, that can
mean "traverse that amount of memory". But when it is in the sweep
phase, what would be an adequate meaning? (To sweep some amount of
ram is much faster than to traverse it, and is almost independent
of the amount of ram.)

Second, the execution time cannot depend *only* on mem_kb. There are
some tasks that must be atomic. Mainly, to finish a collection we must
traverse all stacks and all weak tables atomically. We assume that
programs will not have a very large number of stacks (threads) and weak
tables, but if it has then that final step may take some time. But it is
independent of the number of "regular Lua objects" (tables, closures,
strings).

-- Roberto