1. A method, comprising: executing a first task and a second task in a multi-tasking virtual machine; determining that respective class loaders for the first and second tasks specify the same class definition for a given class name; associating each class loader that specifies the same class definition for the given class name with identical class loader keys; and sharing a runtime representation of at least a portion of a class corresponding to the given class name between the tasks, wherein the class is specified by the respective class loaders associated with the identical class loader keys.