How much memory is being used per program (not process)

Sometimes administrators want to know how much memory is being used by a program (and not per process). This is especially useful to calculate the memory consumption for an oracle instance. Today i found a nice script for doing so here (local mirror).

When called on an oracle database server it produces the following output: