Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6138815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:54:48+00:00 2026-05-23T17:54:48+00:00

i need to have reliable measurement of allocated memory in a linux process. I’ve

  • 0

i need to have reliable measurement of allocated memory in a linux process. I’ve been looking into mallinfo but i’ve read that it is deprecated. What is the state of the art alternative for this sort of statistics?

basically i’m interested in at least two numbers:

  • number (and size) of allocated memory blocks/pages from the kernel by any malloc or whatever implementation uses the C library of choice

  • (optional but still important) number of allocated memory by userspace code (via malloc, new, etc.) minus the deallocated memory by it (via free, delete, etc.)

one possibility i have is to override malloc calls with LD_PRELOAD, but it might introduce an unwanted overhead at runtime, also it might not interact properly with other libraries i’m using that also rely on LD_PRELOAD aop-ness.

another possibility i’ve read is with rusage.

To be clear, this is NOT for debugging purposes, the memory usage is intrinsic feature of the application (similar to Mathematica or Matlab that display the amount of memory used, only that more precise at the block-level)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:54:49+00:00Added an answer on May 23, 2026 at 5:54 pm

    /proc/PID/status contains a few useful pieces of information (try running cat /proc/$$/status for example).

    VmPeak is the largest your process’s virtual memory space ever became during its execution. This includes all pages mapped into your process, including executable pages, mmap’ed files, stack, and heap.

    VmSize is the current size of your process’s virtual memory space.

    VmRSS is the Resident Set Size of your process; i.e., how much of it is taking up physical RAM right now. (A typical process will have lots of stuff mapped that it never uses, like most of the C library. If no processes need a page, eventually it will be evicted and become non-resident. RSS measures the pages that remain resident and are mapped into your process.)

    VmHWM is the High Water Mark of VmRSS; i.e. the highest that number has been during the lifetime of the process.

    VmData is the size of your process’s “data” segment; i.e., roughly its heap usage. Note that small blocks on which you have done malloc and then free will still be in use from the kernel’s point of view; large blocks will actually be returned to the kernel when freed. (If memory serves, “large” means greater than 128k for current glibc.) This is probably the closest to what you are looking for.

    These measurements are probably better than trying to track malloc and free, since they indicate what is “really going on” from a system-wide point of view. Just because you have called free() on some memory, that does not mean it has been returned to the system for other processes to use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a fast, reliable and memory-efficient key--value database for Linux. My keys are
Well... that's it. I need something simple and reliable (doesn't have to have fancy
I have need to return multiple results from a subquery and have been unable
I have need to pack four signed bytes into 32-bit integral type. this is
I have an object which stores a latitude/longitude/altitude, and need reliable and fast -hash
I have one query. Maybe it is a silly question but still I need
Need a clarification while looking at calculating a running checksum. Assume I have data
Hey guys, I have an XML file I need to parse, but only for
We have need for a rating system in a project we are working on,
I have need to select a number of 'master' rows from a table, also

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.