• Esp@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    1 year ago

    ARC can memory leak if you don’t properly use weak references when appropriate. You trade GC ticks for having to deal with a counter. generally GC will (raw language performance aside) have higher throughput (because its not spending time doing ref counts) but will have more sporadic latency because if the GC ticks, then your program is basically on pause until it’s done.

    Comparing them as if one is better than the other feels like painfully missing the point. Completely different memory models. And if you’re only slightly making use of ARC, then switching to a GC is a big jump.

    • TheAgeOfSuperboredom@lemmy.ca
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      I guess that’s my point. The article criticizes reference counting as if it’s strictly worse, but it’s not so simple. Even with a GC funny things can happen so it’s worth understanding the memory model of the language.