たとえば、数千の要素を持つ int 配列があります。
static int st_indices[9999] = {
0, 27, 26, 1, 41, 71, 0, 26, 101, 0, 101, 131, 0, 131, 72,
1, 71, 176, 2, 56, 206, 3, 116, 236, 4, 146, 266, 5, 161, 296,
......
};
と
int* dy_indices = new int[9999] {
0, 27, 26, 1, 41, 71, 0, 26, 101, 0, 101, 131, 0, 131, 72,
1, 71, 176, 2, 56, 206, 3, 116, 236, 4, 146, 266, 5, 161, 296,
......
};
上記の2つの方法、特にメモリ使用量の中括弧の値の違いは何ですか?
st_indices はプログラムが終了するまで (STACK)、dy_indices はdelete []
(HEAP) 後に解放されることを知っています。それとも、スタックと .DATA セグメントに関する質問ですか?