Heap Space
In this tutorial we ll discuss these memory models.
Heap space. The young generation is further divided into the following parts. Memory management is a form of resource management applied to computer memory the essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request and free it for reuse when no longer needed. When space allocated to the young generation gets filled a process called minor gc garbage collection is triggered by jvm to clean up space by removing unreferenced objects.
Whenever we declare new variables and objects call new method declare a string or perform similar operations jvm designates memory to these operations from either stack memory or heap space. Including for java beginner so my recommendation to you is to learn these principles at the same time you learn the java language technicalities. Java heap space message.
When you compile it and launch with 12mb of java heap space java xmx12m oom it fails with the java lang outofmemoryerror.