[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: GC and userdata objects
- From: Viacheslav Usov <via.usov@...>
- Date: Thu, 12 Apr 2018 12:41:09 +0200
Top posting, since I am replying to the entire thread.
This discussion brings back to my memory some older discussions in the list, about deterministic collection/finalization. The principal issue is that some userdata are much more than a handful of bytes, they can be handles, connections, money and what not. I think there is a need to be able to mark a userdarum so that this particular userdatum (and everything that references it) becomes subject to very aggressive collection, perhaps with ref-counting. The argument "this is bad for performance" has been duly noted. I think it is possible to have two major branches in the VM interpreter, the regular branch that works like it does today (without any extra bookkeeping for any object), and the "aggressive" branch which is switched into when there is at least one userdatum marked as described above, and exited as soon as they are all gone. That way the price for the extra bookkeeping will only be paid by those who are willing to pay it.