Here's a rough translation of a tweet by @xharaken.

"Space rays hit computers and mess up the bits in the memory" "hardware bugs mess up the bits in the memory" such things almost never happen, but they happen on a nearly daily basis when there are so many users using a software like [Google] Chrome. So the GC running inside Chrome has a function to check such bit anomalies.

The original:


I do understand that such weird errors happen, but I don't understand how or why checking such errors is important in writing a garbage collector. What I thought was the job of garbage collectors have nothing to do with data integrity in the memory. Think about it - what a garbage collector does is it wipes data in the memory that are no longer referenced. Weird bugs caused by random memory bugs is not in a, at least, say, obvious way, related to a garbage collector's job.

  • 7
    @gnat Related yes, duplicate no. – yannis Dec 6 '15 at 10:24
  • 1
    Perhaps so they don't waste time debugging spurious bug reports caused by random memory errors. That's why redis runs a memory test when it crashes – CodesInChaos Dec 6 '15 at 10:40
  • 2
    @gnat if it's unclear in any case at all - don't dupe vote it, vote it unclear. Somebody following dupe chains through closures is just bad experience. – Jimmy Hoffa Dec 6 '15 at 15:39
  • 3
    I am also unclear how a garbage collector would be able to check for these errors (which do occur, although rarely). This is a task for technology such as ECC. How would a garbage collector know what the contents of the memory is? All it does is look for unused blocks to reclaim. – user22815 Dec 7 '15 at 5:14
  • 1
    I'm glad my question is answered, but still I don't see how this question is a duplicate of this. Sure, @gnat is the first person to have fired up that duplicate claim, and I read his answer too. That's all about the garbage collector's job of freeing memory with data that are unreachable or unused. Nothing about the garbage collector checking random bit errors in the memory. – hello all Dec 7 '15 at 17:21

In any complex, memory-intensive application, random bit errors can be hellishly hard to debug. Anything that helps you detecting them is very useful when your software is deployed to millions of devices. A garbage collector is simply the point where adding functionality to detect such errors produces the smallest overhead and has a good chance of succeeding, because it's the garbage collector's job to constantly inspect the application's memory anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.