Why does this type instability lead to allocations?

Many thanks for your input, @cjdoris.

Interesting. I felt confident that specifying the output of mysumv() would remove this boxing. If this is the source of the allocations, then as you say, it’s likely something that can be fixed. Can you not tell where boxing is occurring in the output of @code_warntype? I assumed it was on red lines of code, but the only red line in the for loop is at %7, which doesn’t relate to the output of mysumv().

If this is the case then I feel that the time taken for dynamic dispatch is something that can be significantly improved also, based on my previous tests.