There's a huge hash table in my application. I use it as a main
memory database. A lot of client write random data into the hash
table, so it call a lot of malloc() / free(). But after it run for
days, I watched it used a lot of memory. Finally it failed to call
malloc (). I use mallinfo() to watch the detail info. I found the
memory usage is different between the RSS value of "top" and
mallinfo().
"top" / "ps" tell me the application memory usage is 1.8G, but
mallinfo() say mallinfo.arena + mallinfo.hblkhd=1G.
Then I use pmap to see detail infomation. The "pmap" report 800M
"anon" blocks.
What's the "anon" blocks that "pmap" reported? Are they memory leak
or fragmentation? How can I avoid it?