aol/cyclops

takeRight can result in OutOfMemoryExceptions being thrown

johnmcclean opened this issue · 2 comments

e.g.

assertThat(empty.takeRight(Integer.MAX_VALUE),equalTo(empty));

The underlying cause is the use of takeRight on ReactiveSeq which allocates an ArrayDeque of the specified size to capture the last X values. Sizing the ArrayDeque to a sensible max and switching to a LinkedList above that max would solve this issue.

Related to #1012

Merged in #1016