How to find memory taken by a process using top command?

I wanted to know how to find the memory taken by a process using top command. The output of the top command is as follows as an example:

Mem:  13333364k total, 13238904k used,    94460k free,   623640k buffers
Swap: 25165816k total,      112k used, 25165704k free,  4572904k cached

PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
16514 applmgr   25   0 2197m 1.7g  10m S  0.3 13.0  15:20.67 java
30692 crestelo  22   0 2901m 1.4g 9284 S  0.0 11.0   3:03.68 java
30431 crestelo  25   0 2043m 1.4g 161m S 50.9 11.0  79:02.73 java
30869 crestelo  25   0 2860m 1.2g 9292 S  0.0  9.6   7:11.18 java
16655 applmgr   23   0 1934m 1.1g  10m S  0.3  8.9   2:17.49 java
16319 crestelo  19   0 1541m 299m  44m S  0.0  2.3   2:52.11 java

I hope, my question is clear as to how to find the memory taken by a process using top command.

Please revert with the reply to my query.

Regards

n: %MEM -- Memory usage (RES)
A tasks currently used share of available physical memory.

Thanks for your answer but I was looking at the amount of memory taken by a process and not the % of CPU used by a process.

%MEM is % of memory used and not % of CPU used by a process.

For knowing amount you can rely on field RES

 
 
RES  --  Resident size (kb)
          The non-swapped physical memory a task has used.
          RES = CODE + DATA.

there are few more fields from which you can collect memory size related information...

 
       o: VIRT  --  Virtual Image (kb)
          The  total  amount  of  virtual memory used by the task.  It includes all code, data and shared libraries plus pages that have been
          swapped out. (Note: you can define the STATSIZE=1 environment variable and the VIRT  will  be  calculated  from  the  /proc/#/state
          VmSize field.)
          VIRT = SWAP + RES.
       p: SWAP  --  Swapped size (kb)
          The swapped out portion of a task�s total virtual memory image.
       q: RES  --  Resident size (kb)
          The non-swapped physical memory a task has used.
          RES = CODE + DATA.
       r: CODE  --  Code size (kb)
          The amount of physical memory devoted to executable code, also known as the �text resident set� size or TRS.
       s: DATA  --  Data+Stack size (kb)
          The amount of physical memory devoted to other than executable code, also known as the �data resident set� size or DRS.
       t: SHR  --  Shared Mem size (kb)
          The amount of shared memory used by a task.  It simply reflects memory that could be potentially shared with other processes.

I was wondering how to get the options for SWAP, CODE. Can you please give the syntax to give with the top command?

For top command

To sort process as per swap page usage

Capital O followed by p (small p) andthen Enter key

not this is wat or something other u look

Would the output of ps do the trick?

ps -lp $PID

Column 10 has the memory size allocated.

ps -lp $$
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S  7006 10701 10700  0  80   0 - 26772 wait   pts/9    00:00:00 ksh

This has my shell process being 26,772Kb

Robin