Re: [Stlport-devel] Tweaking vector allocation
Brought to you by:
complement
|
From: Nigel S. <nst...@nv...> - 2008-08-02 05:09:03
|
> There is no "swap" of allocator state when the > content of the internal vector and slist is swapped over. > > I don't understand what the problem is. If you are using an > allocator implementation that has a state then all copy of the same > original allocator instance should share the same state. See > test/unit/stack_allocator.h, this is an example of allocator > implementation with a state represented by the State struct. François, I was hoping to avoid having centralised allocation state. In part this is due to a desire for multi-threading support. But there are quite a few allocators involved in std::hash_map with the internal vector and slist, including temporary ones. Having allocators that are costly to copy or swap don't seem so promising. Nor any assumption that the same allocator is responsible for allocating and deallocating a node. My main aim is to deal with list, set and map nodes by allocating larger pieces of memory and subdividing those to reduce malloc/free traffic and overhead. I guess this kind of optimisation is not new, but I don't see too much online regarding custom allocators for std::hash_map, std::list and std::map. Thanks again for your suggestions. Regards, - Nigel ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- |