I'm doing extensive computations in f# on short arrays of uint64
; I'd like to stack allocate them to avoid the garbage collector running. In C++, I'd do this:
int search(int n, uint64_t* data) {
while ( /* something */ ) {
// ... do some computation on data.
uint64_t* data2 = (uint64_t*) alloca(n * sizeof(uint64_t));
for (int i=0; i<n; ++i) { data2[i] = /* compute derived value */; }
int candidate = search (n, data2);
// ... determine if candidate is better than best etc.
}
}
But f# doesn't seem to have a primitive, stack-allocated array type?