lua-users home
lua-l archive

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


On Dec 29, 2010, at 9:55 AM, Mark Hamburg wrote:

> On Dec 29, 2010, at 4:43 AM, Roberto Ierusalimschy wrote:
> 
>> The main problem is compatibility. If a program relies on the current
>> behavior, this change will make the program run forever with the
>> collector stopped. So, someone changes from Lua 5.1 to Lua 5.2 and
>> suddenly his program starts consuming huge ammounts of memory; this
>> is not good publicity :)
> 
> 
> You could make "stop" do nothing and introduce "suspend" to pause the collector. This would mean that old code wouldn't behave quite the way intended, but it would avoid the "consuming huge amounts of memory" problem.

That said, my inclination would probably be toward making the change to make the language behave the way the spec suggests but then there needs to be a highly-visible caveats section about code moving from 5.1 to 5.2.

A 5.1 compatibility module could easily redefine collectgarbage so that it would restart the garbage collector on a full collection. If that were coupled with an easy way to build with 5.1 compatibility turned on, the aforementioned caveats could suggest using the backwards compatibility option.

Mark