When I upload a file to Azure Blob, the memory consumption seems pretty high. The following are data from 200 MB file downloads.
public async Task<IActionResult> PostFile(IFormFile file)
{
var filePath = Path.GetTempFileName();
using (var stream = new FileStream(filePath, FileMode.Create))
{
-> Memory used: 108 MB
await file.CopyToAsync(stream);
-> Memory used: 308 MB
await blockBlob.UploadFromStreamAsync(stream);
-> Memory used: 988 MB
}
}
Since the file is already uploaded to the stream, I cannot understand the sharp increase in memory consumption caused by UploadFromStreamAsync (). I am using Microsoft.WindowsAzure.Storage 8.1.4 and .NET Core 1.1.
Am I doing something wrong or is this the expected behavior?
source
share