0

I understand I can use: pmap pid where pid is the process id I'd like to run pmap on, but what if I have a program that I wrote that simply executes once then closes, how would I get the pid for this process? Would it even have a pid after it closes?

As an example lets say I have example.c, which I've compiled into example.

I run it using ./example and it runs once then closes.

How would I use pmap to see the memory usage of example?

BradleyDotNET
  • 60,462
  • 10
  • 96
  • 117
TrolliOlli
  • 909
  • 2
  • 10
  • 18

1 Answers1

0

Add a pause() at the end of your main and do:

pmap `pidof example`

Alternatively, without changing example, you could run it under gdb and break whenever you want to examine the memory with pmap.

cnicutar
  • 178,505
  • 25
  • 365
  • 392