Boost logo

Boost Users :

Subject: Re: [Boost-users] Memory management of boost::mutex
From: Markus Henschel (markus.henschel_at_[hidden])
Date: 2010-07-13 07:34:59

> > Currently we use 1.34.1 but will soon upgrade to 1.43.0. At least in
> 1.34.1 when BOOST_HAS_WINTHREADS is defined a mutex allocates memory >
> for a win32 CRITICAL_SECTION using new operator. It seems like the
> implementation in 1.43.0 has changed completely. Would be great if
> there was no more dynamic memory allocation. On the other hand I can
> never be sure if boost mutex will change the implementation again in
> future versions. Mmmmmm...
> Nor can you be sure that the win32 CRITICAL_SECTION implementation
> won't change

I don't see the point. The windows API is purely C so CRITICAL_SECTION will never invoke any kind of new operator in my code no matter if the implementation changes. Relying on boost::mutex not doing any memory allocations can only be safe if this guarantee is given by the developers for future versions or if boost::mutex would provide support for user defined allocators.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at