Re: Problem only in release version!
- From: "Tom Serface" <tserface@xxxxxxx>
- Date: Tue, 11 Oct 2005 07:18:49 -0700
If it is crashing I'd check overflowing of variable space on the stack
(local variables). For example, if you set up a char buffer to hold 10
chars and you add 11 to it. This kind of thing is very easy to do. The
Debug version may still have the problem, but the stack space is better
protected and the memory is not arranged the same so at run time even if the
problem is really still there it may not crash your program.
As others have suggested uninitialized pointers, etc. are flagged at compile
time so you'd see those warnings at least. However, going beyond allocated
memory or a buffer on the stack is not always caught.
Of course, if this is all managed code, that's not supposed to happen, but
VC allows native and mixed which opens it up again.
Tom
"Peter Oliphant" <poliphant@xxxxxxxxxxxxxxxx> wrote in message
news:uxFeKpfzFHA.460@xxxxxxxxxxxxxxxxxxxxxxx
> Just to affirm Jochen's point, the Debug version initializes most
> variables
> to zero. The Release version will not initialize anything 'naturally'
> (meaning without you writing code to do so), and hence many of the
> variable
> are often given a 'random' value upon loading ('random' in that they keep
> the contents of the memory addresses they happen to get assigned to).
>
> Thus, your new errors are likely the result of some variable that works
> fine
> if initialized to zero, but don't work if not initialized to zero (or not
> in
> some range, non-negative, etc.). Since an application doesn't always get
> loaded at the same place and memory, and because even the same place in
> memory can have different values depending on when you load your program
> (that's why it's RAM not ROM...hehe), you can get random bugs and
> un-stable
> executions of the Release version (i.e., it might do different things on
> different runs depending on the 'random' nature of your variables) even if
> it is totally stable in Debug mode.
>
> Hope that helps!!! : )
>
>
> "Jochen Kalmbach [MVP]" <nospam-Jochen.Kalmbach@xxxxxxxxx> wrote in
> message news:O9nGQJdzFHA.1028@xxxxxxxxxxxxxxxxxxxxxxx
>> Hi babak!
>>
>>> My project works fine in debug version but behaves strangely and
>>> sometimes crashes when I run it in release version.
>>
>> See: Surviving the Release Version
>> http://www.flounder.com/debug_release.htm
>>
>> Mostly it has to do with uninitialized data (in debug this data will get
>> soe "default" value; but in release it will get some random numbers).
>>
>> --
>> Greetings
>> Jochen
>>
>> My blog about Win32 and .NET
>> http://blog.kalmbachnet.de/
>
>
.
- References:
- Problem only in release version!
- From: babak
- Re: Problem only in release version!
- From: Jochen Kalmbach [MVP]
- Re: Problem only in release version!
- From: Peter Oliphant
- Problem only in release version!
- Prev by Date: Re: Problem only in release version!
- Next by Date: Re: Problem only in release version!
- Previous by thread: Re: Problem only in release version!
- Next by thread: Re: Problem only in release version!
- Index(es):
Relevant Pages
|