This repository has been archived on 2019-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
s6-pa-tp/TP3/alloc_statique.c

20 lines
530 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#define SIZE 27500
int M[SIZE][SIZE];
int main() {
// 2.1.1
// Sur une machine de TP Astruc ça plante à partir de SIZE ≥ 1448,
// ce qui correspond à SIZE²×sizeof(int)/1024 = 1448²×4/1024 = 8190 KiB
int i, j;
for (i = 0; i < SIZE; i++) {
for (j = 0; j < SIZE; j++) {
M[i][j] = i + j;
}
}
// 2.2.2
// Avec une definition de M en globale, ça plante à partir de 27500 < SIZE ≤ 30000
// Ça dépend en fait de la quantité de RAM et de SWAP disponible
}