Flat Preloader Icon

Java Virtual Machine (JVM) Stack Area

For every thread, JVM creates a separate stack at the time of thread creation. The memory for a Java Virtual Machine stack does not need to be contiguous. The Java virtual machine only performs two operations directly on Java stacks: it pushes and pops frames. And stack for a particular thread may be termed as … Read more

Memory leaks in Java

In C, programmers totally control allocation and deallocation of dynamically created objects. And if a programmer does not destroy objects, memory leak happens in C, Java does automatic Garbage collection. However there can be situations where garbage collector does not collect objects because there are references to them. There might be situations where an application … Read more

Stack vs Heap Memory Allocation

Memory in a C/C++/Java program can either be allocated on a stack or a heap. Stack Allocation: The allocation happens on contiguous blocks of memory. We call it a stack memory allocation because the allocation happens in the function call stack. The size of memory to be allocated is known to the compiler and whenever … Read more

How many types of memory allocated by JVM?

JVM (Java Virtual Machine) is an abstract machine, In other words, it is a program/software which takes Java bytecode and converts the byte code (line by line) into machine understandable code. JVM(Java Virtual Machine) acts as a run-time engine to run Java applications. JVM is the one that actually calls the main method present in … Read more

How are Java objects stored in memory?

In Java, all objects are dynamically allocated on Heap. This is different from C++ where objects can be allocated memory either on Stack or on Heap. In JAVA , when we allocate the object using new(), the object is allocated on Heap, otherwise on Stack if not global or static. In Java, when we only … Read more

Java Memory Management

This article will focus on Java memory management, how the heap works, reference types, garbage collection, and also related concepts. Why Learn Java Memory Management? We all know that Java itself manages the memory and needs no explicit intervention of the programmer. Garbage collector itself ensures that the unused space gets cleaned and memory can … Read more

Types of JVM Garbage Collectors

Garbage Collection: Garbage collection aka GC is one of the most important features of Java. Garbage collection is the mechanism used in Java to de-allocate unused memory, which is nothing but clear the space consumed by unused objects. To deallocate unused memory, Garbage collector track all the objects that are still in use and it … Read more

Garbage Collection in Java

Garbage collection in Java is the process by which Java programs perform automatic memory management. Java programs compile to bytecode that can be run on a Java Virtual Machine, or JVM for short. When Java programs run on the JVM, objects are created on the heap, which is a portion of memory dedicated to the … Read more

Differences between IPv4 and IPv6

The address through which any computer communicates with our computer is simply called an Internet Protocol Address or IP address. For example, If we want to load a web page or we want to download something, we require the address for delivery of that particular file or webpage. That address is called an IP Address. … Read more

java.net.ServerSocket Class in Java

ServerSocket Class is used for providing system-independent implementation of the server-side of a client/server Socket Connection. The constructor for ServerSocket throws an exception if it can’t listen on the specified port (for example, the port is already being used).It is widely used so the applications of java.net.ServerSocket class which is as follows: In java.nio channel, … Read more