You are asking the wrong question. If the stack size matters, you are doing something wrong.
If you use many datapoints, you will put them in a collection such as an array. Arrays are always allocated per heap. An array of structures embeds individual structures and forms a continuous block of memory. (If you have more than 2 GB, you need several arrays).
While with reference types, the array will contain only links, and objects are obtained separately on the heap. The heap distribution has about 16 bytes of overhead, the link in the array takes into account another 8.
You will also get worse cache locality due to limitations, and the GC needs to do more work to circumvent all of these links.
My conclusion is that if you have a lot of small data, make it a structure and put it in an array.
source share