Creating a big 2D array

I think the best solution would be to allocate the entire 2d array in one piece on the heap, instead of allocating them in parts. This is much simpler and should give you a better memory layout:

const A: *[n][n]u64 = try allocator.create([n][n]u64);
defer allocator.destroy(A);
8 Likes