Writing large DiskArrays to geotiff using ArchGDAL

Hi,
I have a large 2D DiskArrays.BroadDiskArray which I want to write to a Geotiff file without a huge memory overhead. But I do not see a memory efficient way of doing thisDiskArrays.BroadcastDiskArray:

So this is how far I got :

function save_array(
    out_path::String,
    array::DiskArrays.BroadcastDiskArray,
    src_dataset::AG.IDataset,
)
    (m, n) = size(array)
    gds_out = AG.create(
        out_path,
        driver = AG.getdriver("GTiff"),
        width = m,
        height = n,
        nbands = 1,
        options = ["COMPRESS=DEFLATE"],
        dtype = Int32,
    )

    AG.setgeotransform!(gds_out, AG.getgeotransform(src_dataset))
    AG.setproj!(gds_out, AG.getproj(src_dataset))

    AG.write!(gds_out, array[:, :], 1)
   AG.destroy(gds_out)
end

Is there a way to do a window write of the whole array to the dataset without too many memory allocations?

Thanks!

I was able to solve this issue by looking into the ArchGDAL tests on github there are plenty of examples there.