lua-users home
lua-l archive

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


On 16 July 2018 at 14:12, Andrew Starks <andrew@starksfam.org> wrote:
>
>
> On Mon, Jul 16, 2018 at 4:02 AM, Pierre Chapuis <catwell@archlinux.us>
> wrote:
>>
>> On Mon, Jul 16, 2018, at 03:00, Andrew Starks wrote:
>>
>> What about calling collectgarbage(“collect”)?
>>
>>
>> In some system I did that in a global error handler (top-level pcall) to
>> avoid problems. However that forces collection of all garbage, not a single
>> object. I wouldn't do it after a for loop, for instance. Also that doesn't
>> work (or isn't easy to write) if you call `return`.
>>
>> --
>> Pierre Chapuis
>
>
>
> I remain curious. Has this been tested and found too slow before?

Yes. I can't provide a reference right now but relying on
collectgarbage() to force release of non-memory resources via __gc at
the necessary times has proven to be unusable for my workload pattern.
It incurred a significant performance hit due to unnecessary memory
traversal.

-- Hisham