lua-users home
lua-l archive

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


He run his script on an embedded system,and u don't know how many memory he has and how fast his cpu is.So every thing is possible,2.5 sec is not a problem.

u can make sure that if the registered __gc method is called many times every time u script pauses.
if the answer is yes,it is sure that the problem is caused by the gc of u userdata
And the cel table may be another problem too,maybe u can declare it in 2nd script,and pass it 2 the 1st script as param.
Also,I agree with Jerome,The coroutine itself takes some memory.
Lua will do GC cycle when she think there are too many garbage(eg.memory not enough),so u force a GC cycle every loop only make the 2.5 sec parse shared with every loop.

2008/10/24 Jerome Vuarand <>
2008/10/24 Javier Guerra <>:
> On Fri, Oct 24, 2008 at 9:28 AM, Max van Rooij (van Rooij Electronics
> Design & Software Engineering) <> wrote:
>> I have a hunch that Jerome is on the right track, by stating that each
>> new thread gets a copy of the cel table which gets marked for GC after
>> threads' end. If this is the case, then how to prevent it?
> as you already did: forcing a GC after terminating a thread.
> even better would be to reuse it, of course.  for that, don't let it
> finish, but wrap into a loop that yields after the task is done.
> the drawback, of course, is a lot less isolation between tasks

The script creating the array is already not the same as the one run repeatedly.

Max: can you send us the C code loadin both scripts and running them ?