No display in DRAW (VC10) only in optimized mode

Hi, I recompiled OCCT7.3.0 under Windows with VC 10 and everything's fine in debug mode. However when I switch to "Release" in the configuration manager under VC10, DRAW complains even for a very simple script generating a cylinder at the moment when we display it:

Draw[1]> pload ALL
1
Draw[2]> pcylinder c 100 50
Draw[3]> vinit
Driver1/Viewer1/View1
Draw[4]> vdisplay c
An exception was caught 0000000002FCB1B0 : OSD_Exception_ACCESS_VIOLATION: ACCESS VIOLATION at address 0xFFFFFFFFFFFFFFFF during 'READ' operation
** Exception ** 0000000002FCB1B0 : OSD_Exception_ACCESS_VIOLATION: ACCESS VIOLATION at address 0xFFFFFFFFFFFFFFFF during 'READ' operation

The same script runs fine in debug mode.

Any idea? Thanks!

 

Kirill Gavrilov's picture

Make sure that you haven't messed up libraries built with different versions of VS in your building environment (including OCCT 3rdparties).
If there are some doubts - try making a new clean environment (new folder and fresh setup).

Vins Ocell's picture

Hi,

Thanks for the answer but I actually compiled with the 3rd parties provided by OCC (and only them). By the way, I compiled with both CMake and genconf/genproj to get exactly the same ACCESS VIOLATION. So I decided to have small look at the source code:

i) I obtained "vdisplay" source file with "getsourcefile" in DRAW

ii) I noticed the crash happened in ViewerTest.cxx at line 4460 in aCtx->Display (...)

ii) The last function calls AIS_InteractiveContext::Display() in AIS_InteractiveContact.cxx at line 502 in mgrSelector->Activate (theIObj, theSelectionMode, myMainSel); it fails

iii) It calls SelectMgr_SelectionManager::Activate() in SelectMgr_SelectionManager.cxx at line 310 in loadMode (theObject, theMode); where the crash happens.

It's kind of boring because I can do it only with traces in optimized mode and I'm far from being an expert in this field... Do you have an idea to help?

Thank you for all.

Kirill Gavrilov's picture

Which version (Update) of Visual Studio are you using?
What is the output of dversion command?

Here is what prints official vc10 build which executes your test script without issues:

Draw[10]> dversion
Open CASCADE Technology 7.3.0
TBB enabled (HAVE_TBB)
GL2PS disabled
FreeImage enabled (HAVE_FREEIMAGE)
FFmpeg enabled (HAVE_FFMPEG)
OpenGL: desktop
VTK enabled (HAVE_VTK)
Exceptions disabled (No_Exception)
Compiler: MS Visual C++ 10.0 (_MSC_FULL_VER = 160040219)
Architecture: AMD64
OS: Windows
Thanks for the answer but I actually compiled with the 3rd parties provided by OCC

OCC provides the big matrix of pre-compiled components for various compilers, but I suppose that you have downloaded only vc10:
https://www.opencascade.com/content/3rd-party-components

Vins Ocell's picture

I use MSVC 2010 10.0.30319.1 with the precompiled thrid parties coming from the Open cascade set up process and here is the dump of dversion:

Draw[2]> dversion
Open CASCADE Technology 7.3.0
TBB disabled
GL2PS disabled
FreeImage enabled (HAVE_FREEIMAGE)
FFmpeg enabled (HAVE_FFMPEG)
OpenGL: desktop
VTK disabled
Exceptions disabled (No_Exception)
Compiler: MS Visual C++ 10.0 (_MSC_FULL_VER = 160030319)
Architecture: AMD64
OS: Windows

To configure my compilation I just followed the example here : https://www.opencascade.com/doc/occt-7.3.0/overview/html/genconf_windows...

Kirill Gavrilov's picture

It looks like your VS2010 setup lacks critical updates, or their installation is broken.
Hence, compiler might produce broken binaries.

Try installing updates (Service Packs in case of VS 2010).
Updates are very important for compilers, because RTM (sometimes even first two updates) are usually broken.

Vins Ocell's picture

It works great! Thanks a lot!!!