HELP! Release Only Exception

Hello,

When I try to close my app I am getting an exception (Access Violation) in Release mode ONLY.
It breaks at the destructor ~CStringT().
I'm working in VS.NET and I suspect linkage options problem but I can't put my finger on it. :confused:
BoundsChecker complains about MFC70.dll in release mode (library not freed).
Any suggestions?
[376 byte] By [R_Georg] at [2007-11-19 19:43:57]
# 1 Re: HELP! Release Only Exception
Have you tried running your release build in the debugger? Also take a look at this FAQ ( http://www.dev-archive.com/forum/showthread.php?t=269905).
gstercken at 2007-11-10 23:43:02 >
# 2 Re: HELP! Release Only Exception
I was already set for debug in my release build as described in the FAQ you sent. Thanks though.

The debug output is
msvcr70.dll!doexit(int code=2, int quick=0, int retcaller=0) Line 359 C
R_Georg at 2007-11-10 23:44:03 >
# 3 Re: HELP! Release Only Exception
As gstercken stated you really should try running the release build (with debugging info) under the debugger.

This should help you find the problem.

regards,
Darka at 2007-11-10 23:45:01 >
# 4 Re: HELP! Release Only Exception
I already did, see previous post.

Thanks
R_Georg at 2007-11-10 23:46:01 >
# 5 Re: HELP! Release Only Exception
Hello,

When I try to close my app I am getting an exception (Access Violation) in Release mode ONLY.
It breaks at the destructor ~CStringT().
I'm working in VS.NET and I suspect linkage options problem but I can't put my finger on it. :confused: How about your own code being the problem?

Please show your code. No one can diagnose a crash without code.

Regards,

Paul McKenzie
Paul McKenzie at 2007-11-10 23:47:11 >
# 6 Re: HELP! Release Only Exception
I suspect you are deleting a CString* twice.

You need to run it under debugger until it crashes, go to the call stack windows and go back a few levels to see what is being deleted, from there you can work out if you have already deleted it.

:)
Darka at 2007-11-10 23:48:04 >
# 7 Re: HELP! Release Only Exception
A problem in the destructor of CString is practically always a problem with the code. Either you're writing past an array boundary, doing something else that corrupts the CString object's destructor, or the dynamic data that is being destroyed no longer points to valid block in the heap manager.

The bottom line is never blame linkers, compilers, or anything else if the code crashes. Always look to see if your code is what is at fault first before going into looking into the linker or compiler (both tools that are used by thousands of programmers world-wide -- more of a reason to not suspect these things).

Regards,

Paul McKenzie
Paul McKenzie at 2007-11-10 23:49:08 >
# 8 Re: HELP! Release Only Exception
That was my initial suspicion but alas I could not find anything.
R_Georg at 2007-11-10 23:50:05 >
# 9 Re: HELP! Release Only Exception
That was my initial suspicion but alas I could not find anything.So let us see if there is something wrong. Please post your code, otherwise you're basically on your own in finding the problem.

Regards,

Paul McKenzie
Paul McKenzie at 2007-11-10 23:51:13 >
# 10 Re: HELP! Release Only Exception
Thanks.
I am looking for any uintialized strings in the app.
I was not looking to blame the linker but I think my settings for C++/linkage are wrong.
My C++ options for Release are
/Ob1 /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /D "_AFXDLL" /GF /FD /EHsc /MD /GS /Gy /Zc:wchar_t /Yu"stdafx.h" /Fp"Release/CutOff.pch" /Fo"Release/" /Fd"Release/vc70.pdb" /W3 /nologo /c /Wp64 /Zi /TP

My linkage options are
/OUT:"Release/MyApp.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"G:\pubsub\lib" /DEBUG /PDB:"Release/MyApp.pdb" /SUBSYSTEM:WINDOWS /MACHINE:IX86 co_safe.lib ps_api.lib ps_sock.lib csemutil.lib
Is there anything that strikes you as odd?

Thank you in advance.
R_Georg at 2007-11-10 23:52:14 >
# 11 Re: HELP! Release Only Exception
like everyone keeps telling you, you need to post the code and then we can help.

but I think my settings for C++/linkage are wrong

why ?
Darka at 2007-11-10 23:53:10 >
# 12 Re: HELP! Release Only Exception
Thanks.
I am looking for any uintialized strings in the app.I don't know what you mean by "uninitialized strings" exactly, but there is no such thing as an "uninitialized" CString. All CStrings are default initialized to "".

I was not looking to blame the linker but I think my settings for C++/linkage are wrong.
Why do you think they are wrong? I think you should spend more time debugging your application, and not look at the linker settings. Again, this error is caused by mismanaging memory, not linker settings.

Regards,

Paul McKenzie
Paul McKenzie at 2007-11-10 23:54:08 >
# 13 Re: HELP! Release Only Exception
Thank you all for your input.
I went to incremental linking and the exception does not occur any more.

Kind regards
R_Georg at 2007-11-10 23:55:09 >
# 14 Re: HELP! Release Only Exception
A clarification:
I was not linking to msvcr70.dll and msvcpt70.dll which was causing the problem.
Thank you all for your help.

Regards
R_Georg at 2007-11-10 23:56:14 >