memory measurement : different value between top/ps and mallinfo

Discussion in 'C Programming' started by lxu4net, Jun 6, 2008.

  1. lxu4net

    lxu4net Guest

    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?
    lxu4net, Jun 6, 2008
    #1
    1. Advertising

  2. lxu4net

    lxu4net Guest

    My software env is SUSE 10 (with GCC and libc).
    lxu4net, Jun 6, 2008
    #2
    1. Advertising

  3. lxu4net <> writes:
    > 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?


    The C language doesn't refer to mallinfo, RSS, top, ps, pmap, or
    "anon" blocks. Try asking in a forum that deals with your system,
    perhaps comp.unix.programmer or one of the Linux groups.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Jun 6, 2008
    #3
  4. lxu4net

    lxu4net Guest

    I found the mallinfo() only give main arena info. malloc_stats() can
    give all arena info.
    lxu4net, Jun 7, 2008
    #4
  5. lxu4net

    lxu4net Guest

    I found the mallinfo() only give main arena info. malloc_stats() can
    give all arena info.
    lxu4net, Jun 7, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Reiner Funck

    memory-use measurement

    Reiner Funck, Nov 10, 2004, in forum: Java
    Replies:
    1
    Views:
    380
    Chris Smith
    Nov 10, 2004
  2. Alex Vinokur
    Replies:
    3
    Views:
    1,140
    Siemel Naran
    Jul 22, 2004
  3. Cuthbert
    Replies:
    8
    Views:
    428
    Ancient_Hacker
    Sep 13, 2006
  4. Amit Gupta

    mallinfo for 64bit

    Amit Gupta, Nov 8, 2007, in forum: C Programming
    Replies:
    4
    Views:
    425
    Keith Thompson
    Nov 9, 2007
  5. Kevin Ryde

    mallinfo from perl

    Kevin Ryde, Dec 4, 2007, in forum: Perl Misc
    Replies:
    0
    Views:
    77
    Kevin Ryde
    Dec 4, 2007
Loading...

Share This Page