Reducing the memory footprint of applications executed in a virtual machine
AssigneeSun Microsystems, Inc.
InventorMikhail Dmitriev
Life of this patent
Estimating the term…
Abstract
A smaller footprint is loaded into the virtual machine by loading only those methods of library classes that the executed application actually requires. This is accomplished by taking the classes of the targeted application and statically determining which methods of these classes, as well as of the library classes, can actually be used by the application. A generated method usage map of usable methods for each class are saved in a file. At runtime, the virtual machine consults this file and selectively loads into memory only those classes listed in the file. This saves memory space in the virtual machine and speeds execution.
Claims11
A computer-implemented method for loading methods into a virtual machine, the methods contained in one or more classes, the method including:
- recursively scanning through application code beginning at an application entrypoint to determine which methods may be called and the classes to which they correspond;
- wherein said recursively scanning includes:
- finding all methods referenced in said application code;
- and
- finding all methods referenced in methods referenced in said application code;
- generating a method usage map having an identifier corresponding to each referenced method organized under its corresponding class;
- storing identifiers corresponding to all said methods referenced in said application code and all said methods referenced in methods referenced in said application code in said method usage map organized by classes;
- consulting said method usage map upon execution of the virtual machine;
- and
- selectively loading only those methods contained in said method usage map into memory in the virtual machine.
An apparatus for loading methods into a virtual machine, the methods contained in one or more classes, the apparatus including:
- means for recursively scanning through application code beginning at an application entrypoint to determine which methods may be called and the classes to which they correspond;
- wherein said recursively scanning includes:
- finding all methods referenced in said application code;
- and
- finding all methods referenced in methods referenced in said application code;
- means for generating a method usage map having an identifier corresponding to each referenced method organized under its corresponding class;
- means for storing identifiers corresponding to all said methods referenced in said application code and all said methods referenced in methods referenced in said application code in said method usage map organized by classes;
- means for consulting said method usage map upon execution of the virtual machine;
- and
- means for selectively loading only those methods contained in said method usage map into memory in the virtual machine.
A program storage device readable by a machine, tangibly embodying a program of instructions executable by the machine to perform a method for loading methods into a virtual machine, the methods contained in one or more classes, the method including:
- recursively scanning through application code beginning at an application entrypoint to determine which methods may be called and the classes to which they correspond;
- wherein said recursively scanning includes:
- finding all methods referenced in said application code;
- and
- finding all methods referenced in methods referenced in said application code;
- generating a method usage map having an identifier corresponding to each referenced method organized under its corresponding class;
- storing identifiers corresponding to all said methods referenced in said application code and all said methods referenced in methods referenced in said application code in said method usage map organized by classes;
- consulting said method usage map upon execution of the virtual machine;
- and
- selectively loading only those methods contained in said method usage map into memory in the virtual machine.
Dependencies are inferred from the claim text.