3 ms·
Is this sort of multi-tier allocation used in any other garbage collected languages? Or is it specifically used in Haskell because of immutability (which would
by brundolf 6y ago
Is this sort of multi-tier allocation used in any other garbage collected languages? Or is it specifically used in Haskell because of immutability (which would presumably to result in a higher-than-normal frequency of allocation/deallocation)?
- eru 6y agoErlang also has pervasive immutability. But not sure what they are doing for allocation.
- jashmatthews 6y agoIIUC it's enormous amounts of copying since Erlang processes are "shared nothing" and have separately collected private heaps. To reduce copying BEAM has a separate shared heap using refcounting to share big blobs.
- jlouis 6y agoThere is a whole memory allocation system used to combat fragmentation toward the OS level. Erlang also uses a multi-tiered approach, but note that a lot of things are easier because there is far less sharing going on and more things are isolated.
- merijnv 6y ago> which would presumably to result in a higher-than-normal frequency of allocation/deallocation Correct. Not only that, it also dramatically shortens the lifetime of many allocated objects, so the GHC garbage collector is designed for super-cheap allocation and to not be impact by large amounts of garbage. The trade-off here is that this means that the default GC doesn't work very well with very large "live sets" (although there's a bunch of tools and workarounds to make it manageable). For example, my Haskell data processing code averages an allocation rate of ~4 GB/s, despite never going over ~10 MB resident memory or below 98% productivity.
- the8472 6y agoJava's G1GC is similar. You have TLABs, regions and regions grouped into generations/special types and then there's the never-ending work on escape analysis to stack-allocate things.