title: Matrix initialization not working with higher values
body: <p>I have to initialize a matrix which has to be later passed to a Cuda kernel. But I get a segmentation fault when I initialize the matrix. The code is as follows -</p>
  <pre><code>#include &lt;iostream&gt;
  
  int main(){
      size_t m = 512;
      size_t k = 32; 
      size_t n = 32;
      
      float* a = (float*) malloc(m * k * sizeof(float));
      
      if(a == nullptr){
          std::cout&lt;&lt;&quot;Nullptr returned, Check Memory Hardware&quot;&lt;&lt;std::endl;
          exit(-1);
      }
      
      for(size_t i=0; i&lt;m; i++){
      
          std::cout&lt;&lt;i&lt;&lt;std::endl;
      
          for(size_t j=0; j&lt;k; j++){
              std::cout&lt;&lt;j&lt;&lt;&quot;  &quot;;
              a[i*m + j] = 1.0f;
          }
          std::cout&lt;&lt;std::endl&lt;&lt;&quot;=-=-=-=-=-=-=-=- ||||| =-=-=-=-=-=-=-=-=-=-=-=-=-&quot;&lt;&lt;std::endl;
      }
  }
  </code></pre>
  <p>The code only works when <code>m &lt; 100</code>;</p>
  <p>For <code>m &lt; 100</code>, It throws a segmentation fault at <code>i = 97</code>.</p>
  <p>I was able to use matrices of side 2^12 with the exact same code.</p>
  <p>My system configuration - RAM 16GB 2667 MT/s, i7 9750h and RTX 2070.</p>