title: Cannot allocate memory space in in AllocDoubleArray
body: <p>I have a set of images that I iterate trough a C loop and I want to calculate a descriptor on them. The code is very simple:</p>
  
  <pre><code>int main(int argc, char** argv)
  {
  
  FILE *arq = NULL;
  CImage *cimg=NULL;
  Image *mask=NULL;
  Image *gt=NULL;
  CImage *rmask=NULL;
  int  maxR, minR, r, relevance;
  
  if (argc != 5) 
  {       
       fprintf(stderr,"usage: extraction &lt;image&gt; &lt;region mask&gt; &lt;groundtruth&gt; &lt;curve&gt;\n");
       return(1);
  }   
  
  fprintf(stderr, "\nReading Image");  
  cimg = ReadCImage(argv[1]);
  fprintf(stderr, "\nPasso 2: Reading Segmentation");  
  mask = ReadImage(argv[2]);
  fprintf(stderr, "\nPasso 3: Reading Ground-Truth");  
  gt = ReadImage(argv[3]); 
  arq = fopen(argv[4], "a+");
  
  maxR = MaximumValue(mask);
  minR = MinimumValue(mask);
  
  for(r=minR; r &lt;= maxR; r++) 
  {  
      relevance = isRelevant(gt, mask, r);
      rmask = createRegionImage(r, mask, cimg);
      Extraction(rmask,relevance,r,arq);
  
  }
  
  fclose(arq);
  DestroyCImage(&amp;cimg);
  DestroyImage(&amp;mask);
  DestroyImage(&amp;gt);  
  
  return(0);
  }
  </code></pre>
  
  <p>In other words, this code opens an image file and seeks for regions of this image. After that it extracts a feature from each of the image regions.</p>
  
  <p>My problem is the fact that this code works for all image regions except one (26150). It returns the error 'Cannot allocate memory space in in AllocDoubleArray'. The gdb output is</p>
  
  <pre><code>Error:Cannot allocate memory space in in AllocDoubleArray
  
  Program exited with code 0377.
  </code></pre>
  
  <p>The compilation is ok as you can see</p>
  
  <pre><code>rm ../bin/*
  cd ../; make; cd app
  make[1]: Entering directory `/home/me/code/descriptor/source'
  echo "libtexturedescriptors.a built..."
  libtexturedescriptors.a built...
  make[1]: Leaving directory /home/me/code/descriptor/source'
  gcc -O2 -Wall my_program.c -o ../bin   /my_program -I../include -L../lib -ltexturedescriptors -lm
  </code></pre>
  
  <p>Is this region big enough for my PC memory? anybody faced this error before? how to solve it?</p>