473,396 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem only in release version!

Hi everybody
I'm working with a project in embedded Visual Studio 4 and I have a
general problem which I hope that somebody can help me with. My problem
is the following:
My project works fine in debug version but behaves strangely and
sometimes crashes when I run it in release version. I suspect that it
is some sort of memory problem but it is not that easy to find out what
the problem exactly is (the project is rather big with maybe 30000
lines of code).
It should be the same code that runs in the both versions, right? Or is
there some part of the code in a project that might differ in debug and
release version?

Thanks for all your help.
Regards.
/Babak

Oct 10 '05 #1
9 1567
babak wrote:
Hi everybody
I'm working with a project in embedded Visual Studio 4 and I have a
general problem which I hope that somebody can help me with. My problem
is the following:
My project works fine in debug version but behaves strangely and
sometimes crashes when I run it in release version.
That is nothing special. There is a bug that does not demonstrate itself
in debug version.

Actually, those are usually worst kinds of bugs - debugging release mode
is tricky :)

I suspect that it is some sort of memory problem but it is not that easy to find out what
the problem exactly is (the project is rather big with maybe 30000
lines of code).
It should be the same code that runs in the both versions, right?


Unfortunately, no. Issued instruction seqences differ as differ many
other things, including memory allocation etc (debug mode usually has
some sort of improvement that detects allocation bugs).

Mirek
Oct 10 '05 #2

babak wrote:
Hi everybody
I'm working with a project in embedded Visual Studio 4 and I have a
general problem which I hope that somebody can help me with. My problem
is the following:
My project works fine in debug version but behaves strangely and
sometimes crashes when I run it in release version. I suspect that it
is some sort of memory problem but it is not that easy to find out what
the problem exactly is (the project is rather big with maybe 30000
lines of code).
It should be the same code that runs in the both versions, right? Or is
there some part of the code in a project that might differ in debug and
release version?


M$ compilers initialize all variables with 0xcc in debug builds. In
release builds uninitialized variables have indeterminate value which
is often the source of the odd behaviour you observe. Check that you
initialize your variables before the first use.

Oct 10 '05 #3

"Maxim Yegorushkin"
M$ compilers initialize all variables with 0xcc in debug builds. In
release builds uninitialized variables have indeterminate value which
is often the source of the odd behaviour you observe. Check that you
initialize your variables before the first use.


I would look for functions that don't return a value when they were
meant to as part of this checking.

Fraser.
Oct 10 '05 #4
babak wrote:
Hi everybody
I'm working with a project in embedded Visual Studio 4 and I have a
general problem which I hope that somebody can help me with. My problem
is the following:
My project works fine in debug version but behaves strangely and
sometimes crashes when I run it in release version. I suspect that it
is some sort of memory problem but it is not that easy to find out what
the problem exactly is (the project is rather big with maybe 30000
lines of code).
Most problems like this are caused by uninitialised variables.
It should be the same code that runs in the both versions, right? Or is
there some part of the code in a project that might differ in debug and
release version?
Plenty might differ, otherwise why would you have debug and release
versions?

Thanks for all your help.
Regards.
/Babak


john
Oct 10 '05 #5

Fraser Ross wrote:
"Maxim Yegorushkin"
M$ compilers initialize all variables with 0xcc in debug builds. In
release builds uninitialized variables have indeterminate value which
is often the source of the odd behaviour you observe. Check that you
initialize your variables before the first use.


I would look for functions that don't return a value when they were
meant to as part of this checking.


I'm not sure I got you. Do you mean "not all control paths return a
value" warning?

Oct 10 '05 #6
> > > M$ compilers initialize all variables with 0xcc in debug builds.
In
release builds uninitialized variables have indeterminate value which is often the source of the odd behaviour you observe. Check that you initialize your variables before the first use.


I would look for functions that don't return a value when they were
meant to as part of this checking.


I'm not sure I got you. Do you mean "not all control paths return a
value" warning?


Yes there should be a compiler warning. If an object is initialised to
0xCC or 0 or whatever in debug mode before being given a value from a
function that doesn't return anything the object will always have 0xCC
in debug mode and anything in release mode. I had a bug like this
recently. I don't think I got a warning message.

Fraser.
Oct 10 '05 #7
On Mon, 10 Oct 2005 08:15:21 -0700, babak wrote:
Hi everybody
I'm working with a project in embedded Visual Studio 4 and I have a
general problem which I hope that somebody can help me with. My problem
is the following:
My project works fine in debug version but behaves strangely and
sometimes crashes when I run it in release version. I suspect that it
is some sort of memory problem but it is not that easy to find out what
the problem exactly is (the project is rather big with maybe 30000
lines of code).
It should be the same code that runs in the both versions, right? Or is
there some part of the code in a project that might differ in debug and
release version?


In addition to the rest, make sure you don't have valid code inside an
"assert". Asserts go away when compiled for release.

For example:

assert(CodeIReallyNeedInAllBuilds());

is bad, because in release build, the function will not be called.

- Jay

Oct 10 '05 #8
Hi everybody
Thanks for all your replies and help. The problem for me now is to find
out where in the code I might have uninitialized variables or functions
that don't return a value when they are supposed to. As i said before,
it a huge project I'm running so it could be pretty time consuming :(

Regards.
/Babak

Oct 11 '05 #9
babak wrote:

Hi everybody
Thanks for all your replies and help. The problem for me now is to find
out where in the code I might have uninitialized variables or functions
that don't return a value when they are supposed to. As i said before,
it a huge project I'm running so it could be pretty time consuming :(


Good luck.
This is why 'testing during development' and 'development in small
steps' is soooooo important.

If you can, divide the whole project into smaller subprojects and
write test code for the subprojects.

--
Karl Heinz Buchegger
kb******@gascad.at
Oct 11 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rohit Raghuwanshi | last post by:
Hello all, we are running a delphi application with DB2 V8.01 which is causing deadlocks when rows are being inserted into a table. Attaching the Event Monitor Log (DEADLOCKS WITH DETAILS) here....
2
by: CJ Silin | last post by:
Hello, I have a solution which is comprised of 4 projects. One of the project is "used" by the other 3. In each of those 3 project, I created a reference to the project it was going to be using...
15
by: Ken Allen | last post by:
I have been developing a suite of assemblies over the past couple of weeks, and this afternoon somethign started misbehaving. If I do not run the IDE and compiler the code from the command line,...
5
by: Hari | last post by:
Guys please help me to solve this strange problem what Iam getting as follows.. Trying to instantiate a global instance of a template class as follows :- when i build this code with debug and...
5
by: David++ | last post by:
Hi there, I have built a DLL in Visual C++ 6. When I build the DLL it builds fine for the debug version of the DLL (and this DLL works fine), however, I seem unable to build a Release version of...
10
by: babak | last post by:
Hi everybody I'm working with a project in embedded Visual Studio 4 and I have a general problem which I hope that somebody can help me with. My problem is the following: My project works fine in...
4
by: vedrandekovic | last post by:
Hi, I have already install Microsoft visual studio .NET 2003 and MinGw, when I try to build a extension: python my_extension_setup.py build ( or install ) , I get an error: LINK : fatal...
4
by: fniles | last post by:
I am using VisualStudio 2005 (VB.Net). A weird thing happens. I used to have a button and a textbox on my form, and I deleted them. I do a Build on a Release mode. But, the EXE that it creates is...
3
by: Russ | last post by:
I have a Web Service that was originally created with .NET VC 2003, and subsequently converted to the 2005 version. It works fine when built as a debug version, and run on the workstation it was...
1
by: MaheBytes | last post by:
I have been facing a problem with UDP socket programming. I have to reuse port number for two different IP address. I am actually using SO_REUSEADD. I have no problem with debug version but with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.