1. A method for execution of code in a multitenant runtime environment, the method comprising: receiving a request to execute code corresponding to a tenant identifier (ID) in a multitenant environment; wherein the multitenant database stores data for multiple client entities each identified by a tenant ID having one of one or more users associated with the tenant ID, wherein users of each of multiple client entities can only access data identified by a tenant ID associated with the respective client entity, and wherein the multitenant database is a hosted database provided by an entity separate from the client entities, and provides on-demand database service to the client entities; retrieving source code corresponding to the code to be executed from a multitenant database; compiling the retrieved source code; executing the compiled code in the multitenant runtime environment; freeing the memory used by the compiled code in response to completion of the execution of the compiled code.