Patent ID: 8839215

Claim:
A computer-implemented method for optimizing memory usage in a virtual machine having a memory heap, comprising: scanning the memory heap at the end of a start-up process of the virtual machine to identify duplicate strings associated with the virtual machine; storing the identified duplicate strings in a string cache file; determining whether a string created by the virtual machine during the start-up process is already in the string cache file; continuing with the start-up process if no string needs to be created during the start-up process; determining whether the string cache file currently exists for the virtual machine if a string needs to be created during the start-up process; determining whether the created string is already in an interned strings table and if so, returning a reference to the created string in the interned strings table; and creating a new string if a string cache file exists and the new string is not in an interned strings table, wherein the string is one of units that make up a class, and wherein if the string cache file exists at the beginning of the start-up process, then the strings in the string cache file are added to an interned strings table.