title: Out of memory kill
body: <p>I have a problem with the creation of a too big matrix with slurm cluster(Out of memory killed). How can I fix the problem?
  The following code is the part of the code about the allocation matrix:</p>
  
  <pre><code>double  **matrix;
  int rows = 30000;
  int cols = 39996;
  matrix = (double**)malloc(sizeof(double*)*rows);
  for (int i = 0; i &lt; rows; i++)
      matrix[i] = (double*)malloc(sizeof(double)*cols);
  
  for(int i=0; i&lt;rows; i++)
      for(int j=0; j&lt;cols; j++)
          matrix[i][j] = 1;
  </code></pre>
  
  <p>This value (rows, cols) are an example because I can also have larger value
  Instead the following code is the part of code about deallocation:</p>
  
  <pre><code>for (int i = 0; i &lt; 30000; i++)
      free(matrix[i]);
  free(matrix);
  </code></pre>
  
  <p>This my output:
  <strong>Slurmstepd: error: Detected 1 oom-kill event(s) in step 98584.0 cgroup. Some of your processes may have been killed by the cgroup out-of-memory handler.
  srun: error: lab13p1: task 1: Out Of Memory</strong></p>