[boost::pool] using many pools in the application
Hi, Are there any thoughts if using many boost::pool objects ( from 50 to 1000 to maybe 5000 ) in my application will be efficient or not? During the "long" run my program just allocates new chunks, and the deletion of them is done in the end of the program. The reason I use boost::pool is that my simple tests showed me that boost::pool allocates memory 10x faster than standard _new_ operator. But I'm suffering that 1000 pools will cause some kind of memory fragmentation or smth like that... so maybe it will be better to use _new_ operator? I can make some another test for multiple pools, but we know that real application will act in some other way, and I cannot make a decision. P.S.:MS VS2005, XpSp2_x86, boost 1.35 (if any ideas, I'll upgrade to the newest boost version) thank you!
On Wed, 29 Oct 2008 14:34:53 +0100, Roman Shmelev
Hi,
Are there any thoughts if using many boost::pool objects ( from 50 to 1000 to maybe 5000 ) in my application will be efficient or not? During the "long" run my program just allocates new chunks, and the deletion of them is done in the end of the program. The reason I use boost::pool is that my simple tests showed me that boost::pool allocates memory 10x faster than standard _new_ operator.
But I'm suffering that 1000 pools will cause some kind of memory fragmentation or smth like that... so maybe it will be better to use _new_ operator? I can make some another test for multiple pools, but we know that real application will act in some other way, and I cannot make a decision.
Do you really need so many pools? As a pool simply allocates chunks of a single size you only need more than one pool if you need to allocate chunks of different size. That said you only need 5000 pools if you need to allocate 5000 chunks of different size? Boris
Boris! Thanks for reply! I'm really not sure about the count. As for sizes - there will be something near 50 different poolchunk sizes. For example, using many pools in many threads will free me from protecting the pool with locks, and this will optimize performance. Another thing is comfort, for example destroying one pool will free all the chunks allocated with it, so if I will have many "tables" (and pools for each "table"), then it will be very handy and convenient to destroy certain "tables" and free their memory. Any suggestions? I guess maybe there is some problem in the design of my program if I need so many pools...
participants (2)
-
Boris
-
Roman Shmelev