[IGSTK-Users] SpatialObject hard crash when using IGSTK

Jason Gibbs jdgibbs at gmail.com
Fri Mar 18 17:58:10 EDT 2011


Hello,



I feel a bit sheepish in asking for the time of members of the community to
help address my problem, but am hoping that someone will have a quick answer
to what is sure to take me a good deal of time to track down.



I am using IGSTK 4.4 with ITK 3.16 and VTK 5.2.0 on VS Team System 2008
compiling/running in a Vista 64 machine.  We have modified the default CMAKE
configuration of VTK, ITK, and IGSTK to use preprocessor directives
_SECURE_SCL=0 and _HAS_ITERATOR_DEBUGGING=0 for all CXX builds to remove the
overhead of the MS security checks that slow down performance.  These
settings match with our existing code base’s settings (our larger libraries
of which we link to ITK,VTK,IGSTK).  I have used ITK and VTK for a few years
like this with no problems.  All compilation is done in “Release” mode.



I had started experimenting with IGSTK and can perform tracking with an NDI
Polaris tracker with no problems.  An MFC GUI initiates the tracker, tracks
some tools, and closes.  I’ve also added the code from
IGSTKCoordinateSystemTest.cxx to this app, and everything works great, as
expected.



Furthermore, all IGSTK tests (with the exception of
igstkStateMachineExportTest) pass in the IGSTK Solution when Building
“RUN_TESTS”.


So here’s my problem.   As soon as I add the following code (which is a
minimum of what I’ve done to create a problem, I’ve also tried adding
igstkSpatialObjectCoordinateSystemTest3.cxx in its entirety and get the same
problem) I get problems.  Here’s the snippet in main:



igstk::RealTimeClock::Initialize();



{

      {

            typedef igstk::SpatialObject
CoordinateSystem;

            typedef CoordinateSystem::Pointer
CoordinateSystemPointer;

            CoordinateSystemPointer root = CoordinateSystem::New();





      }

      return 0;

}



If I run this executable outside of the debugger I get the “project.exe” has
stopped working dialog.



Inside a debugger, when root falls out of scope, I get a heap corruption in
free.c with the error popping up at retval.



#endif  /* CRTDLL */

        else    //  __active_heap == __SYSTEM_HEAP

#endif  /* _WIN64 */

        {

            retval = HeapFree(_crtheap, 0, pBlock);

            if (retval == 0)

            {

                errno = _get_errno_from_oserr(GetLastError());

            }

        }



Call stack looks like this:

>              msvcr90.dll!free(void * pBlock=0x0000000000000001)  Line 110
C

                project.exe!igstk::SpatialObject::`scalar deleting
destructor'()  + 0x21 bytes       C++

                project.exe!itk::LightObject::UnRegister()  + 0x22
bytes
C++

                project.exe!main(int argc=0, char * *
argv=0x00000053b84b2fd1, char * * envp=0x0000000000000000)  Line 883 C++

                project.exe!__tmainCRTStartup()  Line 586 + 0x19 bytes
C



To test to see if it was entirely an ITK problem (and hence whether I should
post to that user group first, I tried this and did not receive any
crashes):

{

{

itk::CylinderSpatialObject::Pointer obj = itk::CylinderSpatialObject::New();

}



return 0;

}



I’m not extremely familiar with all the dependencies and MS and/or CMake
options that I may have misaligned to cause a problem.



I would be quite grateful for any guidance the community could provide.



Sincerely,

Jason Gibbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20110318/dd7b0cc2/attachment.html>


More information about the IGSTK-Users mailing list