Analysing the size of code-related entities
This page provides an analysis for the size of the image, with a focus on the size of code entities, like methods and classes.
For performance reasons the vaues of these metrics are caches in GtMemoryMetrics
. They can be reset using the snippet below.
GtMemoryMetrics reset
Current image size is 397.48 MiB
.
Total analysed size: 199.69 MiB
Methods: 49.23 MiB
for 353298
methods.
The size of methods includes all bytecodes, additional state and literals. Literals include strings and literal arrays, but excludes symbols.
Classes: 87.25 MiB
for 25625
classess.
Instance Side: 38.89 MiB
Class side: 48.36 MiB
(metaclasses)
The size of classes includes the size of the class object and various method dictionaries, but excludes the actual methods in those dictionaries
Symbols: 5.64 MiB
for 183958
symbols
Pragmas Cache: 1.48 MiB
GT Completion Cache: 44.92 MiB
Packages: 9.47 MiB
Navigation Environment: 1.71 MiB
When using traits, metaclasses use two extra arrays. This can introduce a memory overhead when traits have many users.
Traits overhead: 9.72 MiB
This measures the size of several types of instances, to double check that the previous calculations did not miss something.
MethodDictionary
sanity check:
63442
instances
58.50 MiB
using HashedCollection>>#gtSpecificSizeInMemory
24.87 MiB
using #selector
CompiledMethod
:
353442
instances
49.26 MiB
using CompiledMethod>>#gtSpecificSizeInMemory
29.53 MiB
using #selector
ClassOrganization
:
51252
instances
20.52 MiB
using ClassOrganization>>#gtSpecificSizeInMemory