A runtime code manipulation system is provided that supports code
transformations on a program while it executes. The runtime code
manipulation system uses code caching technology to provide efficient and
comprehensive manipulation of an application running on an operating
system and hardware. The code cache includes a system for automatically
keeping the code cache at an appropriate size for the current working set
of an application running.