Get memory of app

How do I get the memory of my app as shown in Activity Monitor?

According to the docs MemoryUsed doesn’t show the memory fragmentation that Activity Monitor shows:

MemoryUsed As UInt64

Returns the total amount of memory used (in bytes) by the allocated objects.

More specifically, this returns the number of malloc'd bytes. Since the OS does not immediately give back memory after it is released there is no guarantee that this number will match OS values that you see in Activity Monitor, Task Manager or top.

top only shows a percentage. As far as I can see ps is similar to MemoryUsed. What else can I use?

Too much data for top. Is this the absolute memory in the MEM column?

PID COMMAND %CPU TIME #TH #WQ #PORTS MEM PURG CMPRS PGRP PPID STATE BOOSTS %CPU_ME %CPU_OTHRS UID
96388 com.apple.We 0.0 01:59.03 6 1 245 136M 0B 55M 96388 1 sleeping *0[23248] 0.00000 0.00000 502

The MBS plugins can help you. There is the DarwinTaskInfoMBS class there.

1 Like

He… the link is even answered by me. Getting older.