Search code examples
performancevisual-c++opencvcpumingw32

Slow CPU + Windows Explorer + Everything when programming in C++ with OpenCV libraries no matter what IDE and Compiler used


When I was working with OpenCV, I added the build/install folder (i.e. where I had my mingw32-make and mingw32-install files created) to PATH variable. However, this made my PC quite slow after I did a few builds on my CodeBlocks IDE. I didn't forget to deallocate memory or anything like that which might cause trouble. Even a simple hello world program takes ages to run after a few builds. I am using i7 with 8GB of RAM and L3 cache which, I believe, is good enough for any development. After I removed the OpenCV directory from my PATH, it was okay, but not permanently. What could the problem be?

I also checked my environment variables and there is no garbage variable in there! I only have MinGW32 compiler i.e. the bin folder in PATH. But it is necessary (I think!).

Surprisingly, I have tried the same with Microsoft Visual C++ 2010 Express and when I try to build the openCV libraries, it really slows the PC down. For example, if I am trying to open the File explorer on Windows, it takes like 15 seconds for a window to pop up. If I try to open a web browser window, it takes about same time. And I have been monitoring my task manager for weird activities, but nothing! I don't know if it has something to do with Windows 7 64-bit OS.

I am not sure if it has something to do with CodeBlocks itself! I have another PC where I use Visual Studio 2010 Professional and it doesn't have the same problem.

I have manage to isolate the problem around the usage of MinGW compiler. The reason is that the problem occurs only when I am using it with an IDE (tried with Eclipse CDT, Dev CPP, and CodeBlocks). I got a stable release of MinGW downloaded from sourceforge.net which shouldn't have any major memory management issue with Windows Platform. Actually, the problem arises if I use it at all (doesn't start immediately, but after I have run my simply program a few times!).

My MinGW compiler is from http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/mingw-get-inst-20120426/

I couldn't find a very straightforward answer to this, so I am assuming that this is an unusual problem? If it is a repeated question by any chance which I have missed, please post a link to the comment and I will accept the answer. Ta


Solution

  • I just found out that even my Windows Update search/install is causing the same problem....and also the problem desciption was raised in OpenCV http://answers.opencv.org/question/3996/cannot-do-anything-with-opencv-anymore-on-windows/

    I am satisfied with the fact that my windows 7 is damaged somehow during SP1 installation and needs restoring/some other job. I have moved this to superuser.com as it may be OT for here.

    UPDATE I have now managed to fix it (apparently) by restoring the original image build of my laptop. I wish I didn't have to do that though! Microsoft's mess made me go through all these trouble!