From the FSharp.Core sources:
let inline init (count:int) (f: int -> 'T) =
if count < 0 then invalidArg "count" InputMustBeNonNegativeString
let arr = (zeroCreateUnchecked count : 'T array)
for i = 0 to count - 1 do
arr.[i] <- f i
arr
let zeroCreate count =
if count < 0 then invalidArg "count" (SR.GetString(SR.inputMustBeNonNegative))
Microsoft.FSharp.Primitives.Basics.Array.zeroCreateUnchecked count
let inline zeroCreateUnchecked (count:int) =
(# "newarr !0" type ('T) count : 'T array #)
As you can see, the both functions use zeroCreateUnchecked
under the hood, which is compiled to newarr
IL that is supposed to push a new array onto the stack.
The fact that this does not consume any memory in your case might indicate that some kind of optimization is responsible. I think either JIT or the compiler is removing this operation since the created array is never used, and that obviously does not happen in the case of Array.init
.