check the linux process top 10

C++
# ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head

Source

Also in C++: