Project

General

Profile

Actions

Bug #12716

closed

Array#values_at fails for large argument size

Added by v0dro (Sameer Deshmukh) over 7 years ago. Updated over 7 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.1p85 (2015-02-26 revision 49769) [i686-linux]
[ruby-core:77116]

Description

Say I have this Array:

a = [1] * 140_000

Now, I call Array#values_at in this way:

a.values_at(*[1,2,3]*100_000)

I get this error:

Exception: SystemStackError: stack level too deep
--
0: (pry):6:in `__pry__'

Updated by v0dro (Sameer Deshmukh) over 7 years ago

Say I have this Array:

a = [1] * 400_000

Now, I call Array#values_at in this way:

a.values_at(*[1,2,3]*100_000)

I get this error:

Exception: SystemStackError: stack level too deep

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

  • Description updated (diff)
  • Status changed from Open to Rejected

Arguments consume the system stack.

Updated by v0dro (Sameer Deshmukh) over 7 years ago

Nobuyoshi Nakada wrote:

Arguments consume the system stack.

Why not modify the function slightly such that it can also accept an Array containing index numbers as an argument? That way there won't be a need to specify so many arguments.

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

Feel free to submit that feature request.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0