Mandar
Mandar

Reputation: 733

Memory details of a process

How can I get the memory details for a process running on linux? I need to find out specific details like stack size, heap size of a process.

Upvotes: 2

Views: 4044

Answers (2)

Shiwangi
Shiwangi

Reputation: 191

For ubuntu: Grep returns only useful information $ java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|PermSize|ThreadStackSize'

For windows: There is no grep in Windows, instead, we use findstr. C:>java -XX:+PrintFlagsFinal -version | findstr /i "HeapSize PermSize ThreadStackSize"

The -XX:+PrintCommandLineFlags is used to print out the values that modified by VM only

Upvotes: 0

Cédric Julien
Cédric Julien

Reputation: 80831

You will find everything about your process in the /proc/PID directory. Especially in the smaps file where you will find the stack and heap size currently used.

Documentation here

Upvotes: 3

Related Questions