1

ps_mem is an utility to accurately report the in core memory usage for a program. Currently, it works only on Linux.

It doesn't have OSX support. https://github.com/pixelb/ps_mem/issues/6

Are there any other alternatives for OSX to show core memory usage per program?

There are tools like Activity Monitor, top/htop/atop/glances, but they don't give exact usage per program. Any tool that can give this info would be helpful.

I am using ps_mem primarily for a tool that can give memory usage per program instead of process.

5
  • 2
    Can you detail which of the features in ps_mem you're looking for exactly? - What is the purpose of running the program - what are you going to use the results for? There are many possibly options for an alternative here, but when you do not know what you're looking for - it is hard to recommend. For example when you specifically want ps_mem - is that because it sums up memory usage per program instead of per process? - Or is it because you think it is more accurate than other programs?
    – jksoegaard
    Oct 3, 2022 at 9:04
  • @jksoegaard It is because it sums up memory usage per program. Oct 3, 2022 at 11:11
  • 1
    What @jksoegaard is saying is "there is no /proc" on macOS so the tool you want shows zero allocations in that memory model. Unix have many memory models and macOS / iOS / iPadOS share unix heritage and a different kernel than linux and than other unix systems.
    – bmike
    Oct 4, 2022 at 3:55
  • 3
    @bmike No, that’s not at all what I’m saying. I haven’t written my reply yet. The lack of /proc on macOS has nothing at all to do with “memory models” - that’s nonsense. It has no impact on whether or not you can have or make a tool similar to ps_mem on macOS. In fact, it is relatively easy to achieve what Chillar wants.
    – jksoegaard
    Oct 4, 2022 at 5:54
  • No rush @jksoegaard I look forward to your answer when it’s ready to post. I’ll be most interested in how you and the OP define what core memory is and how to measure it on Apple Silicon UMA and if a different definition is needed on the discontinued Intel based Mac lineup.
    – bmike
    Oct 4, 2022 at 9:16

2 Answers 2

1

You may be disappointed if you bring expectations from a different operating system to macOS (or vice versa). IF you need some common ground to get your footing - start with htop on all your target systems.

Instruments is amazing in Xcode for graphically getting at exactly what’s important for macOS performance and tuning.

From the command line - the heap And top commands are where I'd start if you don't want to dive in to Instruments:

4
  • Thanks, @bmike. I just want to find out how much memory each application (eg: chrome, pycharm, emacs) are consuming. Most of the tools are giving usage per process or per thread which is not really useful. I am not looking to optimize the memory usage of any particular app. Oct 4, 2022 at 4:20
  • Could you explain how the per thread accounting is not useful? Is perhaps firing up activity monitor or showing in htop/top possible to illustrate where these aren’t getting you clarity @ChillarAnand
    – bmike
    Oct 4, 2022 at 9:14
  • Out of the total memory, I just want to find out how much "chrome" application is using. If the tool shows per thread/process memory, I have to manually sum up to get the full memory usage of the app. ps_mem does it for users. Oct 4, 2022 at 11:37
  • 1
    I’ll see later if I can get you a better answer with edge browser. Should work the same as chrome I hope. @ChillarAnand
    – bmike
    Oct 4, 2022 at 16:35
0

glances is a cross-platform tool for monitoring. It has AMP plugin by which we define custom monitors.

To monitor Chrome usage, we can define AMP like this.

[amp_chrome]
enable=true
regex=.*Chrome.*
refresh=3

We can load this config when running glances.

$ glances --config glances.conf

It will show CPU/MEM usage for it.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .