Python Forum
python list out top 10 Memory utilisation
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python list out top 10 Memory utilisation
#1
Hi Team,

I want to read top 10 memory utilisation of my system.
other than os.

Below is attempted code which gives all result.

import psutil

def ProcessDisplay():
    listprocess=[]
    for pro in psutil.process_iter():
        try:
            pinfo = pro.as_dict(attrs=['pid','name','username'])
            vms = pro.memory_info().vms /(1024*1024)
            pinfo['vms'] = vms
            listprocess.append(pinfo)
        except(psutil.NoSuchProcess,psutil.AccessDenied,psutil.ZombieProcess):
            pass
    return listprocess

if __name__ =="__main__":
    print("process monitor with memory usage")
    listprocess = ProcessDisplay()

    for elem in listprocess:
        print(elem)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Embedded Python Memory Leaks Alexei 1 1,036 Sep-16-2022, 01:15 PM
Last Post: Alexei
  python memory rd_rakesh 1 1,655 Jul-14-2021, 11:15 AM
Last Post: jefsummers
  Windows Python Memory Scanner Awesometech 1 22,048 Oct-14-2020, 07:44 AM
Last Post: badengagen
  memory leak on embedded python in c++ asdf3721 3 3,408 Jul-16-2020, 06:33 AM
Last Post: Gribouillis
  memory error using permutation list of 11 elements kikidog 1 3,909 Sep-10-2019, 08:22 PM
Last Post: ichabod801
  How to get memory usage and execution time of each line in python SriRajesh 2 3,138 Mar-07-2019, 12:59 PM
Last Post: SriRajesh
  How to reallocating memory space in multithreading program in python ? siva 2 3,401 Mar-08-2018, 03:49 AM
Last Post: siva
  python call c library (about memory copy) vgy 0 2,948 Jul-07-2017, 02:32 PM
Last Post: vgy
  CPU utilisation is confusing Bidgey225 6 5,192 Mar-20-2017, 01:49 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020