Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardRubyMark-sweep and GC.compactSingle-choice MCQ

After GC.compact moves an object to a new slot, code that captured the object's object_id before compaction reads it again afterward. What does MRI guarantee here?

x = Object.new oid = x.object_id GC.compact x.object_id == oid # ?