I'm writing a C# app with ONNX for facial detection and in part of it doing `tensor[0, 2, y, x] = r`. After running the app for a day it used almost 8 GB memory. I coudldn't really find any obvious memory leaks, but found that the indexer actually created a temporary `int[]`. I refactored the indexer to `tensor[2 * width * height + y * width + x] = r`, and did some other (unrelated changes). And now a day later it's at 0.4 GB. Is that how this works?
To pharaphrase the Haskell saying:
> The [garbage collector] should have protected me from this!




