c++ - Clarification on the "object pool" pattern? -


i under impression object pool design pattern used managing group of pre-allocated objects client can request , returned 1 of these objects. however, seems boost.pool's object_pool class has more lower-level memory management object management. why did go name, opposed memory_pool? under wrong impression boost's object pool memory pooling scheme? or same thing? also, why hasn't there been standard implementation of more high-level object pool pattern?

after reading more thoroughly boost.pool documentation, think understand confusion. i'm used thinking of object pool implemented class allocates , manages set of direct objects. consider,

template<class t> class object_pool { private:   std::list<t*> m_reserved; // holds onto objects have been allocated public   t *acquire() { /* grabs reserved list */ } }; 

however, seems boost.pool implements different concept of object pooling, 1 used different purpose 1 suggested above. boost.pool allocates , manages underlying memory of desired object(s), presumably can increase heap performance means of describes simple segregated storage. in fact not follow this concept of object pool pattern. explanation on distinction between 2 patterns can found in answer subsequent question.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -