|
Boost Users : |
Subject: Re: [Boost-users] Strange issue with boost::date_time
From: Neil Groves (neil_at_[hidden])
Date: 2009-04-14 19:12:16
On Tue, Apr 14, 2009 at 11:55 PM, Marshall Clow <marshall_at_[hidden]> wrote:
> At 3:20 PM -0700 4/14/09, Jared Lee Richardson wrote:
>
>> I'm going to try to remove even more code and narrow it down, and then
>> I'll paste the offending code. Basically all I'm doing right now is
>> initializing some time variables, then opening and reading from a
>> file. It crashes on allocating 5 chars inside a function that reads
>> from a file(or on allocating the class that contains a
>> std::list<double> and a double).
>>
>
> Um - do you have a bad pointer somewhere, or a buffer overflow?
> When I see "Crashes while allocating", I think "heap corruption".
> --
> -- Marshall
>
This is definitely my experience also. In fact if it is the only explanation
for an access violation from a non-overloaded new operator that I am aware
of. Hence I would be trying to find the perpetrator of the heap corruption.
I suggest adding:
#include <crtdbg.h>
...
_CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF);
http://msdn.microsoft.com/en-us/library/5at7yxcs(VS.71).aspx
This typically causes the offending code to be close to the region where the
debugger stops. Often this finds the problem within minutes, however I have
experienced problems with assertions attaching to the JIT debugger. Hence
you may still be in trouble since you state that the debugger must be
detached for the problem to occur. My hope is that the fault does occur with
a debugger attached, but there are no obvious symptoms and that increasing
the CRT checking will bring the problem to the fore.
I hope this helps.
Best wishes,
Neil Groves
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