String size limit?

Does Ruby impose a limit on the size of a string? What about the size
of an array?

Thanks in advance.

Rand

Rand Waltzman:

Does Ruby impose a limit on the size of a string?

As it seems, it doesn’t:

irb(main):009:0> ‘a’ * 1_000_000_000; nil
=> nil

RAM and swap weren’t pleased by the above.

irb(main):010:0> GC.start
=> nil

Now they are able to take a breath again.

Kalman