﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-时光隧道-随笔分类-HPC</title><link>http://www.cppblog.com/thinke365/category/11357.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 29 Jul 2009 19:21:42 GMT</lastBuildDate><pubDate>Wed, 29 Jul 2009 19:21:42 GMT</pubDate><ttl>60</ttl><item><title>memcached精髓</title><link>http://www.cppblog.com/thinke365/archive/2009/07/30/91649.html</link><dc:creator>thinke365</dc:creator><author>thinke365</author><pubDate>Wed, 29 Jul 2009 17:44:00 GMT</pubDate><guid>http://www.cppblog.com/thinke365/archive/2009/07/30/91649.html</guid><wfw:comment>http://www.cppblog.com/thinke365/comments/91649.html</wfw:comment><comments>http://www.cppblog.com/thinke365/archive/2009/07/30/91649.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/thinke365/comments/commentRss/91649.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/thinke365/services/trackbacks/91649.html</trackback:ping><description><![CDATA[通常采用malloc和free来管理内存，但是容易造成内存碎片，反而加重操作系统内存管理的负担。 memcached底层的内存管理机制，<font color=red>使用了slab</font><br><font color=blue size=-1>slab的基本思想，是把内存划分为一定大小的块，并把尺寸大小相同的块划分为组。</font><br>slab还有重复使用已分配内存的功能，<font color=green>也就是说分配的内存不会被释放，只会被重复利用。</font>这就减少申请和销毁内存所消耗的时间?<br>memcached维护着一个<span style="COLOR: red">空闲slab块列表</span>，存数据的时候，会选择一个最合适的块，存入数据。(这个列表会有多大? 16G/ 1M = 16M = <font color=red>2<sup>14</sup></font> ) memcached中 key/value 的Map是怎么组织的? 可以直接使用STL中的map来组织?  <img src ="http://www.cppblog.com/thinke365/aggbug/91649.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/thinke365/" target="_blank">thinke365</a> 2009-07-30 01:44 <a href="http://www.cppblog.com/thinke365/archive/2009/07/30/91649.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>