Author Archives: Stanislav_Panteleev

JVM.GC.Why do we need weak references ?

Why Do We Need Weak References in Java? Weak references in Java allow objects to be garbage collected while still being referenced, which is useful for caching, memory-sensitive applications, and preventing memory leaks.

Posted in Без рубрики | Comments Off on JVM.GC.Why do we need weak references ?

JVM.GC.What are soft, weak, and phantom references in Java, and how do they affect garbage collection?

Soft, Weak, and Phantom References in Java In Java, objects are normally referenced strongly, meaning they are not eligible for garbage collection as long as a strong reference exists. However, Java provides Soft, Weak, and Phantom references in the java.lang.ref … Continue reading →

Posted in Без рубрики | Comments Off on JVM.GC.What are soft, weak, and phantom references in Java, and how do they affect garbage collection?

JVM.GC.How do you trigger garbage collection manually, and why is it discouraged?

Although Garbage Collection (GC) in Java is automatic, you can suggest it manually using the following methods:

Posted in Без рубрики | Comments Off on JVM.GC.How do you trigger garbage collection manually, and why is it discouraged?

JVM.What is major, minor, full gc ?

Major GC vs. Minor GC in Java Garbage Collection Garbage collection (GC) in Java is categorized into Minor GC and Major GC, based on which part of the heap is being cleaned.

Posted in Без рубрики | Comments Off on JVM.What is major, minor, full gc ?

JVM.GC.Why regions still need split memory for young and all generation?

Even though Garbage First (G1GC), ZGC, and Shenandoah divide the heap into regions instead of fixed generations, they still logically separate memory into Young and Old generations. This is because generational garbage collection is still the most efficient way to … Continue reading →

Posted in Без рубрики | Comments Off on JVM.GC.Why regions still need split memory for young and all generation?

JVM.GarbageCollection.What means GC only selects regions with the most garbage instead of scanning the entire Young Generation?

This phrase refers to how region-based garbage collectors (like G1GC, ZGC, and Shenandoah) optimize memory cleanup by prioritizing the collection of regions that contain the most garbage, instead of scanning and collecting the entire Young Generation at once (as done … Continue reading →

Posted in Без рубрики | Comments Off on JVM.GarbageCollection.What means GC only selects regions with the most garbage instead of scanning the entire Young Generation?

JVM.GC.Explain the different garbage collection algorithms used by the JVM (e.g., Serial, Parallel, CMS, G1).

Garbage Collection Algorithms in the JVM The JVM provides multiple Garbage Collection (GC) algorithms to efficiently manage heap memory by reclaiming space from objects that are no longer needed.

Posted in Без рубрики | Comments Off on JVM.GC.Explain the different garbage collection algorithms used by the JVM (e.g., Serial, Parallel, CMS, G1).

JVM.GC.What is garbage collection in Java, and how does it work?

Garbage Collection in Java Garbage Collection (GC) in Java is the automatic process of reclaiming memory occupied by objects that are no longer reachable. The Java Virtual Machine (JVM) manages memory dynamically, ensuring that unreferenced objects are removed to prevent … Continue reading →

Posted in Без рубрики | Comments Off on JVM.GC.What is garbage collection in Java, and how does it work?

JVM.MemoryManagement.How does the JVM manage memory for primitives and objects ?

JVM Memory Management for Primitives and Objects The Java Virtual Machine (JVM) manages memory using a structured approach, allocating primitives and objects differently within the heap and stack memory.

Posted in Без рубрики | Comments Off on JVM.MemoryManagement.How does the JVM manage memory for primitives and objects ?

JVM.MemoryManagement.What are memory leaks in Java, and how can you prevent them?

Memory Leaks in Java A memory leak in Java occurs when an application unintentionally holds references to objects that are no longer needed, preventing the Garbage Collector (GC) from reclaiming memory. Over time, this can lead to OutOfMemoryError and degrade … Continue reading →

Posted in Без рубрики | Comments Off on JVM.MemoryManagement.What are memory leaks in Java, and how can you prevent them?