On Thursday, 5 May 2016 at 21:51:56 UTC, Vadim Goryunov wrote:
Question to Liran Zvibel:
Did you (Weka.IO team) consider possibility to write all code
in zeroGC fashion? i.e. pre-allocating as much as possible,
using manual malloc/free for regular allocations or using
arena-style allocator for temporary stuff? If yes, why did you
ended up in using GC.
Hi Vadim,
Of course we allocate everything via pools (the style you
describe as ZeroGC).
Our problem is that some features of D force the GC on you, and
we have to work-around these cases.
For example -- Associative Arrays in D work through the GC so we
have to come up with our own solution, exception handling in the
runtime forces GC based allocation that we worked around to
avoid, and many usecases of runtime scopes, such as delegations.
We have a lot of experience writing D code without the GC, but it
does require paying attention, and not using the some of the
"freebies" that come with D.
I agree with you, that using pooled resources for allocation is
another example where D is much superior to Java.
I even illustrated a good example on my talk: the
NetworkBufferPtr example of my talk showed how we leverage D to
verify that the pointer we keep for a pooled-allocation
NetworkBuffer always came from the right "generation" of that
allocation, making the use much safer.
Cheers
Liran.