11.2. Benchmark It!
Because it's generally so hard to tell by looking at the code where the bottlenecks are (especially since they may move depending on your hardware configuration), you have to be able to measure them objectively. You may have no recourse but to use the native tools of your operating system to measure virtual memory usage in particular. (See Perl of Wisdom #29.) In this respect we confess we are far more experienced on the various Unix platforms than on the Macintosh or Windows.
 We tried measuring process size on Windows 98 using a freeware tool called prcview and were baffled by the results. It appeared that every process out of a couple of dozen was using at least 20 MB.
11.2.1. Measuring Memory Usage
The top program ...