|
Boost Users : |
Subject: Re: [Boost-users] multi_index reserve but allocate
From: Joaquin M López Muñoz (joaquinlopezmunoz_at_[hidden])
Date: 2019-03-20 10:18:02
El 20/03/2019 a las 9:15, Olivier Tristan via Boost-users escribió:
> Hi Joaquin,
Hi Olivier,
Please don't top-post:
https://www.boost.org/community/policy.html#quoting
> My goal is not to be fast but to avoid allocation as I am in a high
> priority thread and I want
> to avoid possible allocation lock.
>
> I tried the allocator [...] using something like that
>
> Â boost::pool_allocator<
> Â ActiveNote, boost::default_user_allocator_new_delete,
> Â boost::details::pool::default_mutex, 256U, 0U>>;
>
> My issue with this solution is that the pool is actually shared across
> all object
> using a boost::pool_allocator that requires a mutex as there are
> multiple thread in my app.
Maybe you can give this allocator a try:
https://probablydance.com/2014/11/09/plalloc-a-simple-stateful-allocator-for-node-based-containers/
It works with Boost.MultiIndex and does not use any mutex at all
(because it's stateful and
as such instances are owned by the containers using them).
JoaquÃn M López Muñoz
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