Xmx2g
Xmx2g refers to the Java Virtual Machine's maximum heap size set to 2 gigabytes using the -Xmx option. The Java heap is the area of memory used for allocating Java objects and related runtime data. Setting -Xmx2g imposes an upper bound on how much memory the JVM will allocate for the heap, independent of the total physical memory available on the system. The -Xmx option can be combined with -Xms to specify the initial heap size as well (for example, -Xms512m -Xmx2g). Memory size units in the Xmx specification include k, m, and g, where 1g equals 1024m and 1m equals 1024k.
Usage example: java -Xms512m -Xmx2g -jar myapp.jar.
Platform considerations: On 32-bit JVMs, the practical maximum heap may be limited by address space, and starting
Impact and guidance: A larger heap can improve performance for memory-heavy applications but can increase garbage