title: CUDA memory allocation - is it efficient
body: <p>This is my code. I have lot of threads so that those threads calling this function many times. 
  Inside this function I am creating an array. It is an efficient implementation?? If it is not please suggest me the efficient implementation.</p>
  
  <pre><code>__device__ float calculate minimum(float *arr)
   {
       float vals[9];      //for each call to this function I am creating this arr
                          // Is it efficient?? Or how can I implement this efficiently?
                          // Do I need to deallocate the memory after using this array?
       for(int i=0;i&lt;9;i++)
           vals[i] = //call some function and assign the values
       float min = findMin(vals);
       return min;
   }
  </code></pre>