[Dune-devel] [Dune-Commit] [Commit] dune-common - f78ce3a: [poolallocator, release] Use a non-static memory pool.

Carsten Gräser graeser at math.fu-berlin.de
Thu Jan 30 16:29:25 CET 2014


Hi Markus,
this looks like a (potentially dangerous) interface change to me.
Its a change since different instances of the same allocator
type are no longer equivalent. Furthermore its dangerous
for the following reason:

While an stl conforming allocator is in principle allowed to be
stateful, the standard also explicitly allows that stl implementations
may require that the allocator is stateless.

Strictly speaking, you can no longer use the pool allocator
with stl containers unless you know that your specific stl
implementation supports stateful allocators.

I'm not proposing to revert the patch and I'm also not sure how to
resolve this issue. I think thats one of the reasons why the allocator
design is said to be broken. However we should at least warn the user
in the docs and the release notes if we keep this patch.

Best,
Carsten

Am 29.01.2014 19:51, schrieb Markus Blatt:
> New commit, appeared at Wed Jan 29 19:51:28 2014 +0100
> as part of the following ref changes:
> 
>     branch refs/heads/master    updated from 75e2716 -> f78ce3a
> 
> Browsable version: http://cgit.dune-project.org/repositories/dune-common/commit/?id=f78ce3a8db88ecda77664f6e7bfa480768e2e999
> 
> ======================================================================
> 
> commit f78ce3a8db88ecda77664f6e7bfa480768e2e999
> Author: Markus Blatt <markus at dr-blatt.de>
> Date:   Wed Jan 29 19:48:38 2014 +0100
> 
>     [poolallocator,release] Use a non-static memory pool.
>     
>     Due to its desgin of using one static memory pool. The allocator
>     could not be used in different threads at the same time without
>     side effects. With this revision each instance will hold its own private
>     instance of the pool.
>     
>     There should be no issues with this patch and poolallocator seems to be
>     mostly used in AMG anyway.
> 
>  dune/common/poolallocator.hh | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> 
> 
> diff --git a/dune/common/poolallocator.hh b/dune/common/poolallocator.hh
> index 9bb4897..e7555bd 100644
> --- a/dune/common/poolallocator.hh
> +++ b/dune/common/poolallocator.hh
> @@ -368,7 +368,7 @@ namespace Dune
>      /**
>       * @brief The underlying memory pool.
>       */
> -    static PoolType memoryPool_;
> +    PoolType memoryPool_;
>    };
>  
>    // specialization for void
> @@ -552,9 +552,6 @@ namespace Dune
>    }
>  
>    template<class T, std::size_t s>
> -  typename PoolAllocator<T,s>::PoolType PoolAllocator<T,s>::memoryPool_;
> -
> -  template<class T, std::size_t s>
>    inline PoolAllocator<T,s>::PoolAllocator()
>    { }
>  
> 
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit
> 


-- 
----------------------------------------------------------------------
Dr. Carsten Gräser       | phone: +49-30 / 838-75349
Freie Universität Berlin | fax  : +49-30 / 838-54977
Institut für Mathematik  | email: graeser at math.fu-berlin.de
Arnimallee 6             |
14195 Berlin, Germany    | URL  : http://page.mi.fu-berlin.de/graeser
----------------------------------------------------------------------




More information about the Dune-devel mailing list