Advanced Ruby
Q95 / 100

What is "ObjectSpace.each_object" used for, and what is a caveat of using it in production code?

Correct! Well done.

Incorrect.

The correct answer is B) It iterates over every live object in the Ruby VM, which can be useful for debugging/memory analysis, but is very slow and can have unpredictable side effects, so it is generally avoided in production code paths

B

Correct Answer

It iterates over every live object in the Ruby VM, which can be useful for debugging/memory analysis, but is very slow and can have unpredictable side effects, so it is generally avoided in production code paths

Explanation

each_object provides powerful introspection across the entire object heap but comes with significant performance overhead and is typically reserved for debugging, profiling, or specialized tooling rather than everyday application logic.

Progress
95/100