In a previous thread I posted, it was stated that invoking Array.Empty<int>()
would return an object from a memory location which was statically allocated, either at runtime or during the first usage of the static Array class.
However, using Rider's memory feature, I find that even after invoking an unrelated method in the Array class, invoking Array.Empty<int>()
makes a new int array with size zero appear on the heap.
Should the object I am seeing appear on the heap already have been there (i.e., in the Before image)? I'm a bit confused.
Before:
After: