After I upgraded to DotNet 4.5, a query started giving me OutOfMemoryExceptions.
The (distilled) query is:
var tests = new int[]{}
.AsParallel()
.GroupBy(_ => _)
.Take(int.MaxValue)
.ToArray();
I'm posting this for anyone with the same problem. I'll answer below.
It appears to be a change in the framework.
The Take() operator is implemented in the TakeOrSkipQueryOperator internal class. There is one branch in the code that goes through a WrapHelper() function that creates a FixedMapHeap instance which in turn creates an array of Key elements of the size passed originally to Take() (which would be an array of 8Gb in the given example).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With