Memory usage of a process having shared libraries

Hi,
I have the following two processes that's built with static libraries. Both the process have many common libraries.
-rwxr-xr-x 1 xxx xxx 152946280 Oct 15 08:38 server1
-rwxr-xr-x 1 xxx xxx 41633880 Oct 15 08:39 server2.

I built these two server processes making all the libraries shared (with kPIC option and -G in the make file). The size of the executable get reduced significantly as shown below.
-rwxr-xr-x 1 xxx xxx 580800 Oct 15 18:40 server1
-rwxr-xr-x 1 xxx xxx 246736 Oct 15 18:41 server2.

Now when I run these processes and monitor the memory usage (using top command), I would have thought that summing up memory usage of (RES column value) the latter two processes would be less than that of the former. But what I observe is exact opposite with both the processes showing higher values in shared case.Can somebody explain why? Is the memory usage that correspond to shared library also getting included as part of process memory usage.
Also I am not sure if I can use the top command to track the memory consumption.
Please advise.

Thanks
Srivatsan

If you have a /proc filesystem, use that to investigate memory usage. Solaris requires a psinfo struct. For linux /proc/self/maps shows shared memory usage

I personally favor calling getrusage() on systems that fully support it, then print periodic advisory messages to the application log file.