473,471 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Unpredictable behaviour

Hi

I have a probelm with a simulation I am running and I was hoping
someone out there may be able to shed some light on the subject.

Before I start, this is what I am using:
MVSC++6.0 (SP6 installed), using 3Ghz Intel machine, Windows Xp, 1.5
Gb SDRAM

This could be a little difficult to explain so please bear with me.

My project is a video encoder that is very big in size and written in C
++.
When I run the sim in Release mode and only when I get to frame 90 do
things start going wrong. However when I run in debug mode, the
projects executes correctly and generates the correct results. Going
back to release mode, I inserted some debugging code (logging
variables to file etc to see if they were in an undefined state etc)
and then the project generated the correct results. So in other words,
only when I was logging specific variables to file in release mode
would the project execute correctly.

Immediately I would think this would be to an uninitialised variable
problem however why is the problem only apparent after 89 frames worth
of encoding? It seems like I have to force the use of these variables
for them to be used correctly. Am I losing the plot?

I have tried to use BoundsChecker to trap any memory leaks and pointer
problems, however because the project is so big and under normal
conditions is so slow to execute, BoundsChecker seems to grid to a
halt and never gets anywhere!

Any suggestions on what else to consider or how to trap this little
nasty?

Many thanks
Ryan
Jan 9 '08 #1
1 1156
That's the insidious feature of undefined behavior. It may indeed
work normally for a while.

There are several things that are different in debug mode and can
be peturbed by inserting inline debugging statements.

Check all your dynamic memory allocation. Any chance you are
writing off the end of an allocation. Eschew managing your own
memory in favor of classes that are already debugged like the
standard containers and strings.

Check array subscripting.

Initialize EVERYTHING. Better to have a deterministic ZERO
than an indeterministic state.
Jan 9 '08 #2

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

Similar topics

3
by: deathyam | last post by:
Hi, I have an Excel 97 app in which I'm using SQL INSERTs to insert data into an Access 97 database table. The table structure is as follows: VersionID (PK) (Long) MetricID (PK) (Long)...
38
by: vashwath | last post by:
Might be off topic but I don't know where to post this question.Hope some body clears my doubt. The coding standard of the project which I am working on say's not to use malloc.When I asked my...
8
by: Andrea | last post by:
I wrote this code: void * xmalloc (size_t size){ register void *value = OPENSSL_malloc(size); if (value == 0) printf("virtual memory exhausted"); return value; } int _chooseTSK(char*...
13
by: bintom | last post by:
Is there any reason why the following C++ code behaves as it does ? int i; i=1; cout << (++i)++; Output: 2 i=1; cout << ++(++i); Output: 3
8
by: bintom | last post by:
Why doe the following C++ code behaves as it does? int i; i=1; cout << (++i)++; Output: 2 i=1; cout << ++(++i); Output: 3 i=1; cout << (i++)++; Output: Error. LValue required...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
1
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.