I know that generics are compiled by JIT (like everything else), in contrast to templates that are generated when you compile the code.
The thing is that new generic typ
Reference types generics all become the same type; value type generics are instantiated separately.
This is because reference types are all really just Object
references (4 or 8 bytes), whereas value types are different and cannot be handled by a single piece of code, due to stack layout differences, etc. Therefore, instantiating multiple copies of a generic type with value types will increase the memory usage by a lot, whereas instantiating multiple copies with reference types won't.