Boost logo

Boost :

Subject: [boost] date_time: second_clock::local_time() results in free in a different heap, vs2008
From: Mike Vasiljevs (mike.vasiljevs_at_[hidden])
Date: 2011-07-18 13:09:23


When using

*Visual Studio 2008, x64, windows 7
*boost release 1.45
*Debug DLL (linked against static C runtime, /MTd) loaded/unloaded by
Host application using release C runtime (debug version not
avaiable!).
*calling "second_clock::local_time()", as in date_time examples

Deallocation problems occur when dll is unloaded. Most likely release
runtime tries to free debug heap block (as far as i can tell at first
inspection).

The problem also occurs by calling localtime on its own:

                time_t tnow;
                time(&tnow);
                struct tm *time_local= localtime(&tnow);
                // use time_local...

the following code, where "tm" is stored in local data segment, so no
problem occurs, unfortunately highly unportable code:

                static __time64_t tnow;
                _time64(&tnow);
                
                static struct tm time_local;
                _localtime64_s(&time_local, &tnow);
                // use time_local...

greetings

mike


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk