0

I am working with OpenCV2.4 and SVM classification and I need to load a big dataset (about 400Mb of data) in C++. I've been able to save this dataset under a XML file, but I am unable to load it after that. Indedd, I receive the following message :

OpenCV Error: Insufficient memory (Failed to allocate 408909812 bytes) in OutOfMemoryError, file (my opencv2.4 directory)modules\core\src\alloc.cpp, line 52 - error: (-4)

How could I increase the available memory (I have plenty of free RAM) ?

Thanks a lot !

EDIT : Here is the place where the problem appears. The code works when I load a smaller file

  std::cout<<"ok 0"<<std::endl;
  FileStorage XML_Data(Filename, FileStorage::READ);
  XML_Data["Data"]>>m_Data_Matrix;
  XML_Data.release();
  std::cout<<"ok 1"<<std::endl;

EDIT 2 : Problem solved : the solution was to compile my application and OpenCV2.4.5 as a 64 bit application. I've installed a 64 bit version of MinGW, build OpenCV with this new version (and using cmake to configure) and then modified the compiler used by codeblocks. You could find these links usefull : http://forums.codeblocks.org/index.php?topic=13016.0 and http://www.drangon.org/mingw.

goodblues
  • 51
  • 5
  • Small code snippet will be helpful, I think. – Rasim May 28 '13 at 14:31
  • 1
    One potential reason of this error: somewhere you have a memory leakage. – Rasim May 28 '13 at 14:36
  • Thanks for the suggestion, but I don't think it is a leakage problem : the problem is my dataset is too big for the allowed memory. My question is : how can I modify this allowed memory ? – goodblues May 29 '13 at 07:08
  • I have no enough information to help you. Please, try to watch out this question: http://stackoverflow.com/questions/3596990/whats-the-graceful-way-of-handling-out-of-memory-situations-in-c-c. Bad advice: try to create a 64 bit application, it can utilize much more memory. – Rasim May 29 '13 at 08:59
  • 1
    It was the good solution. It works now :-). Thanks ! – goodblues May 30 '13 at 12:15

0 Answers0