Project

General

Profile

Bug #12716

Array#values_at fails for large argument size

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

Status:
Rejected
Priority:
Normal
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__'

History

Updated by v0dro (Sameer Deshmukh) over 2 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 2 years ago

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

Arguments consume the system stack.

Updated by v0dro (Sameer Deshmukh) over 2 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 2 years ago

Feel free to submit that feature request.

Also available in: Atom PDF