|
Boost Users : |
Subject: Re: [Boost-users] [pool] singlton_pool::malloc returning bad address
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-07-02 18:47:25
AMDG
Jonathan Leonard wrote:
> I'm just using the default specialization like such:
>
> struct scalable_alloc_tag {};
> T* ret = (T*)boost::singleton_pool<scalable_alloc_tag, sizeof(T)>::malloc();
> if (!ret)
> throw std::bad_alloc();
>
> new (ret) T();
>
What is sizeof(T)?
> Yep, malloc and free are being called simultaneously from the main thread and worker threads. The docs say that it is thread-safe "if there is only one thread running before main() begins and after main() ends" [which is our case].
>
Okay. Yes. The default specialization should be thread-safe.
It doesn't look like there is any way for the implementation to
be bad in that respect since it simply locks around every operation.
Just to be pedantic, you might check to make sure that
BOOST_NO_MT is not defined after including any pool headers.
> A rough calculation shows that approx 8.64 billion alloc/free pairs occurred before the crash.
>
Okay, that's way more than my brief test got to.
In Christ,
Steven Watanabe
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