I will be working with approximately 320,000,000 data points for a high-resolution waveform. Each data point will require 2 floats (XY coordinate) for a total of 8 bytes.
In order to have this memory allocated all at once, I was planning on using a struct
such as the following:
public struct Point
{
public float X; //4-bytes
public float Y; //4-bytes.
}
Since a struct is a value type, I am assuming that it consumes only the amount of memory necessary for each variable, as well as some small, fixed amount used by the CLR (Common Language Runtime).
Is there a way I can compute how much memory a struct will use during runtime of my application? That is, granted I know the following:
- How many variables are in the struct.
- How many bytes are used for each variable.
- How many instances of the struct will be alive at a given point in time.