seniorRuby

How does Ruby handle long-lived object promotion in generational GC?

Updated May 17, 2026

Short answer

Objects surviving multiple minor GC cycles are promoted to old generation to reduce scanning overhead.

Deep explanation

Ruby GC tracks object survival across minor collections. If an object survives threshold cycles, it is promoted to the old generation. Old generation is scanned less frequently, reducing GC overhead. Promotion reduces repeated copying and improves throughput for long-lived objects such as cached configurations or class metadata.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Ruby interview questions

View all →