Skip to content

Comment on Never create Ruby strings longer than 23 charactersparent

Comments

The "aux" union contains either the reference count or the string capacity. The idea must be that shared strings are immutable so the capacity is not meaningful. Conversely, if the string is not shared, the reference count is not meaningful.

The outer "as" union either contains the 24 byte char array or the 24 byte (len + ptr + aux) heap string information.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.