answersLogoWhite

0

What is garbage collection answer?

User Avatar

Anonymous

13y ago
Updated: 8/19/2019

Garbage collection is the phrase used to describe automatic memory management in Java. Whenever a software program executes (in any programming language for that matter), it uses memory in several different ways. We're not going to get into Computer Science 101 here, but it's typical for memory to be used to create a stack, a heap, in Java's case constant pools, and method areas. The heap is that part of memory where Java objects live, and it's the one and only part of memory that is in any way involved in the garbage collection process.

So, all of garbage collection revolves around making sure that the heap has as much free space as possible. For the purpose of the exam, what this boils down to is deleting any objects that are no longer reachable by the Java program running. When the garbage collector runs, its purpose is to find and delete objects that cannot be reached. If you think of a Java program as being in a constant cycle of creating the objects it needs (which occupy space on the heap), and then discarding them when they're no longer needed, creating new objects, discarding them, and so on, the missing piece of the puzzle is the garbage collector. When it runs, it looks for those discarded objects and deletes them from memory so that the cycle of using memory and releasing it can continue.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

How do you force garbage collection in java?

. Garbage collection cannot be forced. Calling System.gc() or Runtime.gc() is not 100 percent reliable, since the garbage-collection thread might defer to a thread of higher priority


What is the need for garbage collection?

Assuming you mean garbage collection in computers: it is a method often used to reclaim memory, once it is no longer used. Note that garbage collection is not the only possible way to manage memory.


Who performs the garbage collection?

A garbage truck. In computer programming, a process known as the garbage collector.


Garbage collection in the Middle Ages was often done by .?

Garbage collection in the Middle Ages was often done by roaming animals.


Who are famous people who have a garbage collection?

Everyone in the world has a garbage collection and really does not matter if you are famous or not. To not have your garbage collected would be consider unsanitary to some and hoarding to others.


How you can inforce the garbage collection?

Forcing Garbage CollectionFirst and foremost, unlike this paragraphs title, garbage collection cannot be forced. However, Java provides some methods that allow you to request that the JVM perform garbage collection.In reality, it is possible only to suggest to the JVM that it perform garbage collection. However, there are no guarantees the JVM will actually remove all of the unused objects from memory (even if garbage collection is run).


2 What is the purpose of garbage collection in java and when is it used?

Garbage collection prevents memory leaks. In Java, the Java Virtual Machine will garbage collect whenever there is memory that has no references.


What are the Rules and regulations in collection and disposal of garbage?

recycling


When the number of references to an object becomes that object is marked for garbage collection?

When the object is no longer referenced anywhere else in your program, then the object becomes marked for garbage collection.


What level of government handles garbage collection?

Local government.


What are the recycling days in Rockville Centre New York?

Collection Schedule Circle SectionMonday - Garbage & RecyclablesWednesday - Rubbish & NewspapersThursday - Garbage & RecyclablesSquare SectionTuesday - Garbage & RecyclablesWednesday - Rubbish & NewspapersFriday - Garbage & Recyclables


What is garbage collection in terms of computer science?

As it relates to computer science, the phrase garbage collection refers to a type of memory management. This is an automatic process in which the 'garbage collector' program reclaims memory that has been assigned to a program but is no longer in use by it and can now be made available.