1 / 14

runtime memory management

runtime memory management ppt

Manoranjan2
Download Presentation

runtime memory management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Runtime Memory Management presented by:- Roshan Kumar Sahoo(210720100091) MCA sec-B Batch - 2021-23

  2. TOPICS:- • STACK • HEAP • STACK VS HEAP • GARBAGE COLLECTION IN JAVA

  3. STACK:- • Stack is a linear data structure which stores a collection of objects. • stack follows LIFO algorithm. • mainly the following three basic operations are performed in the stack: • Push: Adds an element to the top of the stack • Pop: Removes an element from the top of the stack. if stack is empty it returns an Underflow • Top: Returns the top element of stack • isEmpty: if stack is empty it rerturns true, else false

  4. Limitations of stack:- • Stack can only remove the last item you added • This works perfectly for local variables, since they come and go as the execution enters and exits functions • But, it does not work well for the data whose lifecycle does not depend on individual functions • the memory heap allows you to add and remove data whenever you want

  5. MEMORY MANAGEMENT - GARBAGE COLLECTION

  6. GARBAGE COLLECTION:- • Garbage means unreferenced objects • Garbage collection is a process of destroying the unreferenced objects • In java, garbage collection is performed automatically, thus providing better memory management • If heap is full, garbage collection starts from the older objects

  7. THANK YOU!!!!

  8. Object cloning

  9. What is object cloning? • The object cloning is a way to create an exact copy of an object. for this purpose, the clone() method of an object class is used to clone an object. the cloneable interface must be implemented by a class whose object clone to create.

More Related