Understanding how native images manage memory
Native images come bundled with Substrate VM, which has the functionality of managing memory, including garbage collection. As we saw in the Building native images section, the heap allocation happens as part of the image creation to speed up the startup. These are classes that are initialized at build time. Refer to Figure 5.3 to see how the Native Image builder initialized the heap region after performing static region analysis. At runtime, a garbage collector manages the memory. There are two garbage collection configurations that the Native Image builder supports. Let's understand these two garbage collection configurations in the following subsections.
The Serial garbage collector
The Serial Garbage Collector (GC) is the default that gets built into the native image. This is available both on the Community and Enterprise edition. This garbage collector is optimized for a low memory footprint and small heap size. We can use...