Analysing the size of the image
This page gives a high-level overview of where the memory of the image goes. The details are in Analysing the size of code-related entities, Analysing the size of the code index and Analysing the size of Lepiter databases.
The values are cached in GtMemoryMetrics
and GtLepiterMemoryMetrics
. They can be computed again using the snippet below, which can take several seconds.
GtMemoryMetrics reset. GtLepiterMemoryMetrics reset.
The image file has 336.83 MiB, as of the last save. The source code of methods is not in the image, but in the sources file (43.19 MiB) and the changes file (80.81 MiB).
In memory, the image now has 571.19 MiB: all objects after a full garbage collection, including the objects created by the UI and the user. Saving the image now would write roughly this size.
The virtual machine reserves a heap of 870.80 MiB. Most of it is the old space (848.83 MiB), of which 9.47 MiB are free. New objects are first allocated in the eden of the new space (15.97 MiB).
The analysis accounts for 267.30 MiB of the image in memory:
Methods: 78.08 MiB, with their literals, blocks and pragmas.
Classes: 84.87 MiB, of which 39.06 MiB are method dictionaries and 25.62 MiB the extra method dictionaries of classes using traits.
Symbols: 6.91 MiB. Pragmas cache, packages and the navigation environment are small; see Analysing the size of code-related entities.
GT code index: 59.78 MiB, used for searching code, senders and implementors. See Analysing the size of the code index.
GT Book: 31.90 MiB, the only Lepiter database saved in the image, including its index. See Analysing the size of Lepiter databases.
The rest, 303.89 MiB, is not part of these analyses. It contains the global state of the system (for example fonts and caches of forms), the objects created by the UI and the user, and the Lepiter databases loaded at startup (all loaded databases use 31.96 MiB). GtImageStateMemoryMetrics
attributes all objects that are not code to who holds them: the GT Book, the code index, the other Lepiter databases, the class-side state of each package and the globals. It walks the whole image, so it takes a while; see Analysing memory in a live image.
Method dictionaries are a large part of the size of classes. Classes that use traits, and their subclasses, keep two extra method dictionaries, and methods from traits are copied into every class that uses them.
The GT code index is one of the largest code-related structures. Most of it is the selectors cache, used for senders and implementors.
In Lepiter databases, most of the memory is in cached ASTs, of text snippets and of the coders of code snippets, and not in the text itself.