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 605.79 MiB
.
Total analysed size: InstanceVariableNotFound: methodSelectors not found in AllProtocol (no messages) - 0 selector(s)
Methods: 57.94 MiB
for 411516
methods.
The size of methods includes all bytecodes, additional state and literals. Literals include strings and literal arrays, but excludes symbols.
Classes: InstanceVariableNotFound: methodSelectors not found in AllProtocol (no messages) - 0 selector(s)
for 29209
classess.
Instance Side: InstanceVariableNotFound: methodSelectors not found in AllProtocol (-- all --) - 7 selector(s)
Class side: InstanceVariableNotFound: methodSelectors not found in AllProtocol (no messages) - 0 selector(s)
(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: 6.46 MiB
for 208269
symbols
Pragmas Cache: 2.83 MiB
GT Completion Cache: 52.21 MiB
Packages: Instance of RPackageOrganizer did not understand #default
Navigation Environment: 1.95 MiB
When using traits, metaclasses use two extra arrays. This can introduce a memory overhead when traits have many users.
Traits overhead: 11.91 MiB
This measures the size of several types of instances, to double check that the previous calculations did not miss something.
MethodDictionary
sanity check:
72748
instances
69.52 MiB
using HashedCollection>>#gtSpecificSizeInMemory
29.63 MiB
using #selector
CompiledMethod
:
411713
instances
57.97 MiB
using CompiledMethod>>#gtSpecificSizeInMemory
34.60 MiB
using #selector
ClassOrganization
:
58418
instances
InstanceVariableNotFound: methodSelectors not found in AllProtocol (-- all --) - 1 selector(s)
using ClassOrganization>>#gtSpecificSizeInMemory