Posts

Showing posts from June, 2021
Image
Object Oriented Programming     Topic:   Memory Management In Java   Domain - Blog       Introduction   Any computer program we write needs basic essential resources like CPU for math & computing, and finally memory for managing the data. Memory is a limited resource and it has to manage effectively. For memory management in Java, we need to first understand how the memory is allocated, referenced, de-allocated, and finally, what happens to the memory after de-allocation. Once the memory de-allocated, the memory would be marked free for future usage. In Java, if the memory is allocated to a variable and the variable is still referencing it, the memory would be allocated not available for other variables/program. Hence, if a code is written to allocate a resource for usage with no clean-up after the job done, the allocated memory unit would be locked forever leading to a memory leak, eventually, leading to an error cal...