Subject: [Boost-bugs] [Boost C++ Libraries] #3788: object_pool åå¨æ¯è¾ä¸¥éçæçé®é¢ã
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-12-22 06:45:22
#3788: object_pool åå¨æ¯è¾ä¸¥éçæçé®é¢ã
---------------------------------------+------------------------------------
Reporter: Dai Yun <dy95020@â¦> | Owner: yupeng
Type: Bugs | Status: new
Milestone: Boost 1.42.0 | Component: pool
Version: Boost 1.41.0 | Severity: Problem
Keywords: object_pool |
---------------------------------------+------------------------------------
boost::object_pool è¿ä¸ªåè½å¹¶æ²¡æé误ï¼åªæ¯å¨å建åå é¤å¯¹è±¡æ¶ï¼åå¨çå¾ä¸¥éçæçé®é¢ãå¦ä¸ï¼
1. å建对象æ¶ï¼å¨ç³è¯·ä¸ä¸ªå¤§å
åååï¼éè¦å¯¹æ¯ä¸ä¸ªå°åå
éåï¼å¹¶èµå¼ä¸ä¸ªå°åï¼è¿ä¸ªæ¯è¾æµªè´¹æ¶é´ãå½ç¶è¿ä¸ªé®é¢ä¸æ¯å¾ä¸¥éã
2. éæ¾å¯¹è±¡æ¶ï¼å³å¨è°ç¨ boost::object_pool::free() å
boost::object_pool::destroy() æ¶ï¼é®é¢å°±æ¯è¾ä¸¥éäºã主è¦å¨äº void *
simple_segregated_storage<SizeType>::find_prev(void * const
ptr)è¿ä¸ªå½æ°ï¼æ¯å½ç¨ç©è¯·æ± free ä¸ä¸ªæéæ¶ï¼ä»éè¦ä»é¾è¡¨å¤´å»æ¥æ¾è¯¥èç¹çåä¸ä¸ªèç¹ãæ¯å¦è¯´ï¼å¦æç¨æ·å·²ç» malloc äº 10000
个èç¹ï¼ç¶ååä»å¤´ free äº 9000 个ãé£ä¹å¨ free 第 9001 个æ¶ï¼ä»ä¼ä»é¾è¡¨å¤´éåå 9000
个èç¹ä¸éãè¿ä¸ªæ¶é´è±è´¹çç¸å½é¿ã
æå·²ç»éæ°åäºä¸ä»½ object_pool çå®ç°ãæçæäºå¾å¤§çæé«ã
æµè¯å¦ä¸ï¼å
malloc 10000 个对象ï¼å free è¿ 10000 个对象ãæµè¯æºå¨é
ç½®ï¼
CPU: Intel(R) Core(TM)2 4300@ 1.80GHz
ããMEM: 2.00 GB
boost::obbject_pool ç¨æ¶çº¦ 8 - 9 ç§ã
object_pool ç¨æ¶çº¦ 3 - 4 毫ç§ãï¼æéåç object_poolï¼ã
å ä¸ºä» svn ä¸è½½ boost çæ¶é´å®å¨å¤ªé¿äºï¼è¿æ»æ¯ä¸è½½ä¸åæäºï¼æ以åææ代ç å¨é件æ¶å¥ä¸ãå
å«äºæµè¯ä»£ç ã
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3788> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC