[boost-users] crash of visual studio compiler with boost bind

Hello, the following code makes the VC++ compiler (VS 2005) crash, but only when I am trying a release build ! The debug builds work fine. std::sort(l_vec.begin(),l_vec.end(),boost::bind(std::less<int>(),boost::bind(&CLayer::GetPrio,_1),boost::bind(&CLayer::GetPrio,_2))); Where CLayer::GetPrio returns an integer. Best regards, Oliver

Oliver, please try increasing internal compiler heap. Please read about /Zm option in MSDN. Regards, Ovanes On Thu, Aug 7, 2008 at 10:59 AM, Oliver Kania <kania.oliver@googlemail.com>wrote:
Hello, the following code makes the VC++ compiler (VS 2005) crash, but only when I am trying a release build ! The debug builds work fine.
std::sort(l_vec.begin(),l_vec.end(),boost::bind(std::less<int>(),boost::bind(&CLayer::GetPrio,_1),boost::bind(&CLayer::GetPrio,_2)));
Where CLayer::GetPrio returns an integer.
Best regards, Oliver
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Note that sometimes VS2005 compiler crashes when you've got some mismatch in placeholder count, but if it compiles well in debug-mode, then...it's really wierd. By the way, it seems that in VS2005 the compiler heap is at maximum by default. 2008/8/7, Ovanes Markarian <om_boost@keywallet.com>:
Oliver, please try increasing internal compiler heap. Please read about /Zm option in MSDN.
Regards, Ovanes
On Thu, Aug 7, 2008 at 10:59 AM, Oliver Kania <kania.oliver@googlemail.com> wrote:
Hello, the following code makes the VC++ compiler (VS 2005) crash, but only when I am trying a release build ! The debug builds work fine.
std::sort(l_vec.begin(),l_vec.end(),boost::bind(std::less<int>(),boost::bind(&CLayer::GetPrio,_1),boost::bind(&CLayer::GetPrio,_2)));
Where CLayer::GetPrio returns an integer.

Crash under release but not debug can be due to unintialized data or memory corruption with different behavior under debug/release. Since the release build use different optimizations you may try a release build but adding also the debug info. -----Messaggio originale----- Da: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] Per conto di Igor R Inviato: giovedì 7 agosto 2008 11.43 A: boost-users@lists.boost.org Oggetto: Re: [Boost-users] [boost-users] crash of visual studio compilerwith boost bind Note that sometimes VS2005 compiler crashes when you've got some mismatch in placeholder count, but if it compiles well in debug-mode, then...it's really wierd. By the way, it seems that in VS2005 the compiler heap is at maximum by default. 2008/8/7, Ovanes Markarian <om_boost@keywallet.com>:
Oliver, please try increasing internal compiler heap. Please read about /Zm option in MSDN.
Regards, Ovanes
On Thu, Aug 7, 2008 at 10:59 AM, Oliver Kania <kania.oliver@googlemail.com> wrote:
Hello, the following code makes the VC++ compiler (VS 2005) crash, but only when I am trying a release build ! The debug builds work fine.
std::sort(l_vec.begin(),l_vec.end(),boost::bind(std::less<int>(),boost::bind (&CLayer::GetPrio,_1),boost::bind(&CLayer::GetPrio,_2)));
Where CLayer::GetPrio returns an integer.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

I think it is not possible anymore to increment the internal compiler heap in VS2005 Best regards Hansjörg Ovanes Markarian schrieb:
Oliver, please try increasing internal compiler heap. Please read about /Zm option in MSDN.
Regards, Ovanes
On Thu, Aug 7, 2008 at 10:59 AM, Oliver Kania <kania.oliver@googlemail.com <mailto:kania.oliver@googlemail.com>> wrote:
Hello, the following code makes the VC++ compiler (VS 2005) crash, but only when I am trying a release build ! The debug builds work fine.
std::sort(l_vec.begin(),l_vec.end(),boost::bind(std::less<int>(),boost::bind(&CLayer::GetPrio,_1),boost::bind(&CLayer::GetPrio,_2)));
Where CLayer::GetPrio returns an integer.
Best regards, Oliver
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> http://lists.boost.org/mailman/listinfo.cgi/boost-users
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

On Thu, Aug 7, 2008 at 11:48 AM, Hansi <hansipet@web.de> wrote:
I think it is not possible anymore to increment the internal compiler heap in VS2005
Best regards Hansjörg
It is possible. I did it as well and it helped sometimes... http://msdn.microsoft.com/en-us/library/bdscwf1c(VS.80).aspx Greetings, Ovanes

You are right..but it works only for precompiled headers... I had an similar error also without precompiled headers (using serialization) and there the only solution was to make the header file simpler and smaller... Best regards Hansjörg Ovanes Markarian schrieb:
On Thu, Aug 7, 2008 at 11:48 AM, Hansi <hansipet@web.de <mailto:hansipet@web.de>> wrote:
I think it is not possible anymore to increment the internal compiler heap in VS2005
Best regards Hansjörg
It is possible. I did it as well and it helped sometimes... http://msdn.microsoft.com/en-us/library/bdscwf1c(VS.80).aspx
Greetings, Ovanes
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

It is true that the zm option works only with precompiled headers. Any other ideas ? Cheers, Oliver 2008/8/7 Hansi <hansipet@web.de>
You are right..but it works only for precompiled headers... I had an similar error also without precompiled headers (using serialization) and there the only solution was to make the header file simpler and smaller...
Best regards Hansjörg
Ovanes Markarian schrieb:
On Thu, Aug 7, 2008 at 11:48 AM, Hansi <hansipet@web.de <mailto: hansipet@web.de>> wrote:
I think it is not possible anymore to increment the internal compiler heap in VS2005
Best regards Hansjörg
It is possible. I did it as well and it helped sometimes... http://msdn.microsoft.com/en-us/library/bdscwf1c(VS.80).aspx<http://msdn.microsoft.com/en-us/library/bdscwf1c%28VS.80%29.aspx>
Greetings, Ovanes
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

I made an experience, that it helped in case without precompiled headers as well, but that was prior to VC8.0 Which error exactly do you get? Try to install an SP? Another possiblity which helped in my case, was to either extract the lambda expression to a local variable (like boost::function instance), or to introduce a factory method (another level of indirection) which produced the boost::function. Greetings, Ovanes On Thu, Aug 7, 2008 at 2:09 PM, Oliver Kania <kania.oliver@googlemail.com>wrote:
It is true that the zm option works only with precompiled headers. Any other ideas ?
Cheers, Oliver
2008/8/7 Hansi <hansipet@web.de>
You are right..but it works only for precompiled headers...
I had an similar error also without precompiled headers (using serialization) and there the only solution was to make the header file simpler and smaller...
Best regards Hansjörg
Ovanes Markarian schrieb:
On Thu, Aug 7, 2008 at 11:48 AM, Hansi <hansipet@web.de <mailto: hansipet@web.de>> wrote:
I think it is not possible anymore to increment the internal compiler heap in VS2005
Best regards Hansjörg
It is possible. I did it as well and it helped sometimes... http://msdn.microsoft.com/en-us/library/bdscwf1c(VS.80).aspx<http://msdn.microsoft.com/en-us/library/bdscwf1c%28VS.80%29.aspx>
Greetings, Ovanes
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

2008/8/7, Oliver Kania <kania.oliver@googlemail.com>:
It is true that the zm option works only with precompiled headers.
Refer to the MSDN: http://msdn.microsoft.com/en-us/library/bdscwf1c(VS.80).aspx

Interestingly, when I turn off "use unicode response file" in the compiler options, the crash no longer appears .... best regards, Oliver 2008/8/7 Igor R <boost.lists@gmail.com>
2008/8/7, Oliver Kania <kania.oliver@googlemail.com>:
It is true that the zm option works only with precompiled headers.
Refer to the MSDN: http://msdn.microsoft.com/en-us/library/bdscwf1c(VS.80).aspx<http://msdn.microsoft.com/en-us/library/bdscwf1c%28VS.80%29.aspx> _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Oliver Kania <kania.oliver <at> googlemail.com> writes:
Hello,the following code makes the VC++ compiler (VS 2005) crash,but only
when I am trying a release build ! The debug builds work fine.std::sort (l_vec.begin(),l_vec.end(),boost::bind(std::less<int>(),boost::bind (&CLayer::GetPrio,_1),boost::bind(&CLayer::GetPrio,_2))); Where CLayer::GetPrio returns an integer.Best regards,Oliver It is not an answer to your question, but may be a workaround: Boost.Bind now supports direct <, so one could write: std::sort(l_vec.begin(), l_vec.end(), boost::bind(&CLayer::GetPrio,_1) < boost::bind(&CLayer::GetPrio,_2)); Which is also more readable.
participants (6)
-
Andrea Denzler
-
gast128
-
Hansi
-
Igor R
-
Oliver Kania
-
Ovanes Markarian