Posts

Showing posts from June, 2021

Difference between Threads and Process and static variable --- Who will create new thread for each Http Rest Request - Java Memory Management

Image
Java Memory Management  vv Ref:  https://www.geeksforgeeks.org/java-memory-management/ Stack Memory Basics-: Stack memory used in java to store datatype , function calls and reference variables for objects ( handle to objects ). its contains short-live (weak) references for objects stored in heap. whenever a function called , a block of memory reserved for that function and local primitive values and reference to other objects stored inside that functions block space. when function executions' ends function block space will free and available for other methods. When all space in stack is full then jvm will throw java.lang.StackOverFlowError exception. See below example in image -   Heap Memory Basics-: Heap memory used in java for store Objects and java classes. when we will create an object it will take space in heap memory. Any object created in heap accessed by all threads, it has global access. Inside application anytime we can make reference for that object. Time to ...