Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual Studio 6.0 Release/Debug Mode

Status
Not open for further replies.

donxiaoyu

Programmer
Dec 4, 2001
4
US
Hi,

I am preparing to deliver my MAPI application but I get the last problem. My application, which builds on MS Visual Studio 6.0 Document/View (MFC)type, can run on debug mode orrectly but if I switch to release mode, I could not get my results correctly. I have searched other resources but only one thing is clear that in my program I need a big memory such as two 16384 size CString arrays. Can someone give me a clue? Any comments are highly appreciate!

Thanks!


Don

 
It is too early for delivering after debug mode runs are OK (in VS or what else). The next project stage: test release mode builds. It's an ordinal situation when hidden errors show itself in release mode. Release exe code != debug exe code, so they may run differently.
Alas, no common rules to detect such errors...
 
Look for:

1) Inappropriate logic in ASSERT, e.g:

ASSERT (++counter < limit);

This works fine in debug but not in release, because in release build everything inside the ASSERT is removed, including the side effect of incrementing the counter. Replace such code with:

++counter;
ASSERT (counter < limit);

2) Mismatched runtime libraries

If your project involves linking two or more separate components (e.g. an EXE plus 2 LIBs) make sure all components are compiled to use the same version of the runtime library.

3) Old project settings

In Visual Studio when you are working on your project and changing settings like preprocessor definitions, compiler switches, etc., you are only changing the settings for the "debug" build. A lot of people forget to go apply the same changes for the "release" build. It's worth it to compare every project settings screen between debug and release builds, and see if there are any significant differences.
 
ArkM,
I know that release exe != debug exe. Usually debug exe size is about ten time the size of release exe. But how can I located those hidden errors (release exe) you mentioned in the previous message. This is my concern. My release exe runs well (no run-time error) but no results as well. So far, the only thing I think is that my program is involved in big memory operation.

Thanks!

Don
 
We might be able to help you better if you could describe what you mean by "could not get my results correctly". What results were you expecting, and what did you get? What did you mean in your last message when you said you got no results?

You can always use the debugger, even for a release exe. Turn on debugging information and try single-stepping through the program. The optimizer may cause some lines of code to be optimized together, removed entirely, or even swap positions with other lines, and some of your variables might not show up at particular times, but you might still be able to see enough to find the problem.

For example, if you did have code inside an ASSERT, like I mentioned before, you would see it by noticing in the debugger that you cannot set a breakpoint on the line of code for an ASSERT, and trying to single-step into it results in it jumping completely over it without stopping on it.
 
We all know it's a very hard question (teriviret suggest very useful approaches).
May be it's too abstract: localize, make hypothesis, try reproduce, study suspicious modules (in debug mode too).
Sometimes try to add any kind of watch windows...
 
My application is about parsing coming email messages based upon these email message patterns. Please see the attachment file. These steps are
1) My program reads email from MS Outlook 2000 client;
2) If the send includes the following string as "isinet.com", my program
will process otherwise disregard;
3) Each time, load one email body into memory. Then search each article
pattern, e.g. each article is separate one empty line, and
"=========================", and one empty line again;
4) Once located each article, my program search sub-patterns such as
Author:, Title:, Abstract:, Volume:, ISSN:;
5) Once get these info, my program connects to MS SQL 2000 database
server and save these info into database.
6) Continue to process all email message body until finish, then go to
1) unless there is no unread email;

My problem is all my application is based on Visual Studio 6.0 Document/View model to develop my codes. In the debug mode, everything is fine. But if I switch my project to release mode in Visual Studio mode, I run my program under release mode, and I couldn't get the same results. Here, I mean that one of structures I defined for holding info from parsing email content such as Author name, Title, Volume and issue number is empty. I have located that structure contains NULL values for Author name, Title, Volume and Issue number, which before my program do database and log file operation. But I cannot do further since my debug version work fine. Otherwise, I can debug if step by step. So I really don't know what should I locate the problem further. I think that this problem might be related to Visual Studio but I am not very sure. I can post my entire codes but I cannot do here.
Also, after I get the response here, I have double check my project settings on both Debug and Release mode. I am sure that they are compatible. Any comments are appreciated!
P.S.
My original program is designed on win32. It works fine on debug mode but I got a R6016 run-time error if I switch it to Release mode. That is the reason I later switch to Document/view type.
 
R6016 = "not enough space for thread data". Wow, never got that one before. That's really strange.

One question I have is why do you need 16384-element CString arrays?

Maybe you are consuming an overwhelmingly huge amount of memory, to the point where some of your memory allocations are failing? That would explain why you are seeing NULLs -- memory allocation routines can return NULL (or throw exceptions) if they fail.
 
teriviret
The reason I need to open char[16384] array is to be considered about the email message patterns I got from The Thomson Corporation( Otherwise my pattern search module will be more complicated. Also I believe if the debug exe runs o.k. why release exe should get trouble?

Regarding the R6016 error, I think that it might be related to my globle variables definitions but not very sure.

Thanks!

Don
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top