When you say "This object is never unboxed", note that "boxing" a value type
does not do anything to the original type, just like "unboxing" does not change the original reference type.
The name "boxing" is a bit confusing because it sounds like you are encapsulating your original value in some way, but you are actually creating a
new object which has the initial value same as your original value.
- int i = 1;
-
object o = i;
-
-
// changing i will not change o
-
i = 2;
-
-
// this will display "1", not "2"
-
Console.WriteLine(o);
Since your new object is a reference type, GC will collect it when it gets out scope, just as any other object, so there will not be any memory leaks.