次のようにC#で配列を使用しています:
class abc
{
xyz x = new xyz(); // some other class
public double [] arr = new double [100]; // Allocated 400 bytes
// for this array.
// 100 is imaginary size
// shown here for simplicity.
// Actual size will depend on input.
private void something()
{
x.funA(arr);
}
}
上記のクラスabc
では、配列は 400 バイトを消費しています。今、私はクラスにあるパラメータとしていくつかの関数でこの配列を渡しましたxyz
。
私の質問は、新しい 400 バイトが class に割り当てられるかどうかxyz
です。400 バイトはそれほど問題ではありませんが、私のプログラムでは、1 MB を使用する配列を渡しています。