Boost logo

Boost Users :

Subject: [Boost-users] Memory management of boost::mutex
From: Markus Henschel (markus.henschel_at_[hidden])
Date: 2010-07-12 06:01:20


Hi,

we have a custom memory manager that overrides global new/delete. It is currently not thread safe. Because we require thread safety now I wanted to ad a mutex and some locks around the critical parts. Unfortunately boost::mutex allocates memory itself. So while the memory manager is created it tries to create it's mutex which causes global new to be called which calls the memory manager which is not created yet. I solved this for several data structures inside the memory manager by using custom allocators and by overriding the memory managers new operator to directly call malloc and free for its needs. But I don't see a way to customize memory management in boost mutex. Can it be achieved somehow?

Thanks

Markus Henschel
Lead Programmer

YAGER Development GmbH
Pfuelstraße 5
10997 Berlin
Germany

www.yager.de

Sitz der Gesellschaft: Berlin | Geschäftsführer: Timo Ullmann, Uwe Beneke
Amtsgericht Berlin-Charlottenburg | HRB 78261 | USt-ID-Nr. DE 212404124


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