Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • Good work, I found malloc_stats() last night and used it to pretty good effect in my testing earlier today. I also ran across sourceware's glibc wiki which pointed to Ulrich Drepper's livejournal with this post - udrepper.livejournal.com/20948.html - from April '09 describing the replacement to mallinfo (amoungst other things) but I've yet to try it out. Thanks for posting the output, looks very interesting. +1 Commented Apr 7, 2010 at 19:25
  • By the way, did you find any doc for malloc_info()? Does the first argument describe the arena number? I see the <heap nr="0"> in the output, and in my test malloc_stats() shows stats for a number of arenas (aside: mallinfo() also seems to be limited in that it only shows information from the zero-th arena, which is why my tests of it didn't match the memory usage I saw reported by top; also, no single arena statistic grew enough to hit the bug I referenced before). Commented Apr 7, 2010 at 19:30
  • I can't find docs for malloc_info(). According to the source, if (options != 0) return EINVAL - sourceware.org/git/?p=glibc.git;a=blob;f=malloc/…. Looks like it iterates through all arenas. Commented Apr 8, 2010 at 4:56
  • 2
    My running processes stdout was redirected to some log file. so call malloc_stats() didn't print out on console, but rather that log file. Took me almost an hour to figure that out. Commented Feb 20, 2019 at 2:26