Boost logo

Boost Users :

From: Brown Gabe (gabosgab_at_[hidden])
Date: 2006-04-27 13:21:01


I tried commenting out the std::cout call and it still crashes for some
reason. I'm trying to track down the problem to the uninitialized memory
but I can't seem to locate it for some reason. I tried implementing a
slight simplier version to try and track down the fault.

Can anyone reproduce this error on a vanilla install of Visual Studio 2005?
I'm wondering if this is a VC8 flaw for Boost or just some weird libraries
that I'm using with boost.

Here is the sample code:

==============[Sample Code]=====================

void ThreadTest() {

    return;

};

int main(int argc, char* argv[])
{

    boost::thread thrd(ThreadTest);
    thrd.join();

   return 0;
}

==============[Sample Code]=====================

On 4/27/06, Ovanes Markarian <om_boost_at_[hidden]> wrote:
>
> This is really a strange behavior. I can your sample app in VC 2003
> without any crashes...
>
>
> Try to comment the output to std::cout after your timer has elapsed...
> Maybe there is a problem
> with writing to streams and cout somehow does not block and main exists
> while cout is written... ?
>
>
> On Thu, April 27, 2006 2:42, Rush Manbert said:
> > Brown Gabe wrote:
> >> Hi Everyone,
> >>
> >> Hopefully this isn't some noob question, but here goes... I'm trying
> to
> >> run boost 1.3.1 in Visual C++ 8 VC8 and I keep getting an access
> violation
> >> at the termination of my thread. I've tried looking to see what the
> problem
> >> is but I can't seem to determine the problem. I'm using the plain
> example
> >> thread.cpp
> >>
> > <snip>
> >
> >> I get the expected out from the application. Upon tracing my code, the
> >> exception only occurs when the worker thread exits.
> >>
> >> Exception occured in threadex.c on line 348.
> >> Unhandled exception at 0x7c9012b4 in test.exe: 0xC0000005: Access
> violation
> >> reading location 0xcccccccc.
> >>
> >> " __try {
> >> _endthreadex (
> >> ( (unsigned (__CLR_OR_STD_CALL *)(void
> >> *))(((_ptiddata)ptd)->_initaddr) )
> >> ( ((_ptiddata)ptd)->_initarg ) ) ;"
> >>
> >> Any thoughts on what might cause an error like this???
> >>
> >> --
> >
> > Others may have more intelligent, or more focused, suggestions, but here
> > are two things to check:
> >
> > 1) 0xcccccccc looks very much like the contents of an uninitialized
> > variable when running under the debug heap management code. My guess is
> > that you are using an uninitialized pointer value whose contents are
> > 0xcccccccc.
> >
> > See http://www.codeguru.com/cpp/w-p/win32/tutorials/article.php/c9535__1
> > the follow the "continued" link to the second page. The fill values are
> > listed there.
> >
> > 2) I assume you're using VS 2005? The Debug | Exceptions... dialog lets
> > you set it to break when an exception is thrown, rather than fielding an
> > unhandled exception. I don't know anything about debugging threads,
> though.
> >
> > Best of luck,
> > Rush
> >
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

--
-Gabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net