Method and apparatus are disclosed for the intensive use of garbage collection
in order to determine the exact amount of memory that is consumed by a running
application at any point of its execution. A garbage collector executes immediately
prior to allocations of memory during execution of a program. The amount of memory
used by the application is known after each such allocation of memory, and is very
close to or equal to its theoretical requirement. A developer is also enabled to
determine whether a specified memory allotment for an application is ever exceeded.