When roxie determines that a sort needs to spill, it allocates the index array needed to make the quicksort stable (using malloc heap).
There is no guarantee that this will succeed, and you could argue that it should be taken from the roxiemem heap. Other components allocate this array as they go along (to ensure that it will succeed).
There are disadvantages to allocating as you go - in particular it puts a burden on the cases that don't need to spill.
Worth discussing if there are any alternative approaches (a shared "scratch" memory area that was preallocated, for example).