program works in debug but not in release mode

Posted on 2004-04-13
Last Modified: 2010-04-01

i'm writing a program to read cpu details etc.
but the program will cause 100% cpu usage and not respond under release mode but in debug it works fine
you can find both version at

someone already suggested that it might be the compiler optimization problem, i tried turning off optimization in MS 2003 but it doesnt help

any ideas would be very appreciated
Question by:madonion87
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1

Author Comment

ID: 10811156
this might help

"in the release build, after GetMessage is called, it goes on comparing whether the call has failed, and if not calls TranslateMessage and so on but the loop is very tight. whats more odd is the program never seems to pass control to windows, and forever looping and handling messages.

whereas in the debug build, after all messages are handled, program passes control to windows after a GetMessage call."

another guy i know in ocau forum said it, i'm not very sure what he means though
LVL 48

Assisted Solution

AlexFM earned 100 total points
ID: 10811261
You need to post source code (some code fragments may be posted here, or make the whole project available for download). exe file doesn't help us to solve your problem.
Except of this, I don't beleive there is an expert who downloads unknown exe file from WEB and runs it on his own computer :-)

Author Comment

ID: 10811425
lol sorry

you can find the source code at

tell me if you need the header files
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 86

Expert Comment

ID: 10812896
>>you can find the source code at ...
>>tell me if you need the header files

Everything that you do not post here is pointless, as it renders the Q worthless for others. Sorry.
LVL 86

Assisted Solution

jkr earned 200 total points
ID: 10812920
LVL 14

Accepted Solution

wayside earned 200 total points
ID: 10813652
Check out


for some good discussion on why things work in debug and not in release, and what to do to fix it.

Author Comment

ID: 10821959
i've already looked at that site, tried turning off optimization as well, didnt help
thats why i want to see if anyone have also experienced the same problem, or know what might have caused it
LVL 86

Expert Comment

ID: 10825044
So, have you also tried to _DEBUG_ your release build then?
LVL 14

Expert Comment

ID: 10828224
When all else fails...

add print statements.

Author Comment

ID: 10832610
turning off aliasing fixed the problem
i think i will split the points into those who contributed, thanks

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maze travler 6 73
Excel/Word Add-in in what language? 5 162
GUI: DIalog Stacking and Popping in MS C++ 4 96
C++ help/ Toy problem 19 70
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question