Why would a java programmer know how the garbage collector works and how the bytecode works?


Everyone around is saying this. But how is this applied in practice? After all, GC was invented to make it easier for the programmer to work with memory, so that the programmer could abstract from it. And we are often told that we need to understand how GC works. I see only one practical application of bytecode – this is if a person writes his own language on the JVM platform. Is it also used in practice somewhere?


The garbage collector has different strategies and implementations:

  • Serial GC,
  • Parallel GC,
  • CMS GC,
  • G1.

Each of them has a set of its own parameters, adjusting which you can achieve fine-tuning of the JVM for a specific application (depending on the tasks, you can increase the bandwidth, reduce STW delays, reduce the resources consumed, correctly allocate memory for the young / old generation, etc. .). Naturally, it is not necessary to know these nuances, and you can simply use the standard JVM settings … Until your application begins to devour all available RAM or there are delays in its work. Then this knowledge will come in handy. In my opinion, a good programmer is different in that he has a broad outlook and knows how the tool that he uses works.

Scroll to Top