answersLogoWhite

0


Best Answer

all classes and variables created in a program are put on something called the Heap, which is stored in main memory (RAM).

The Garbage collector gets rid of any class or variable that becomes impossible to reference ever again in the program.

For example, say you have a main method and from there you call another method, any local variables created in that other method will be put on the heap while they are in use, ie that function is running. As soon as the method ends, the Garbage collector will come and "release" the memory where those variables were for use in other parts, because you can never access them again when the method finishes.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

In order to use memory, programs conduct an action called "allocation" where part of the memory is set aside for a particular use. The C malloc() function and its counterpart calloc() are used to allocate memory.

When this memory is no longer needed, it is freed with the free() function. The prototypes for both functions are available in stdlib.h.

However, as memory is allocated and freed in various locations, the memory can become fragmented. Sometimes requests to allocate memory will fail as a result. The areas that are causing the allocation problems are referred to as "garbage" for historic reasons.

"Garbage collection" is the process of moving allocated memory around to make larger contiguous blocks available (like defragmenting your hard disk). However, due to technologies existing in terms of memory management, garbage collection is a very low priority for C and C++.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

In computer programming, it is a method used to free unused memory. Objects that are unreachable from the program will eventually be cleared by a process called the "garbage collector". Objects typically become unreachable when the program that created them gets out of scope, or when the variable that points to them gets re-used and points to another object. There is no specific guarantee WHEN the garbage collector will free up the unused memory; at the latest, it should run if the program is low on memory.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

it means it is automatically used to release memory which is allocated by compiler.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What do you mean by garbage collection in data structure?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What do you mean by ''GIGO'' in computer education?

GI/GO is a computer programming term for Garbage In/Garbage Out. It means that if you have incorrect data input, then your output will be incorrect


Can a data type be called a data structure?

Yes, they can be used interchangeably, but they usually mean separate things. A type of data is something like an integer, or string. While a data structure usually refers to a linked list or tree of integers or strings.


What is the difference between a Database and a Data Structure?

A data structure is the internal representation of the data. It may be a list, a linked list, a stack, heap or just about anything else that can be immagined and represented internal to the machine. For example, the data structure may be a linked list of control blocks for a specific product that is progressing through an automated machining facility. The control block may include information regarding the product, the tolerances, date/time that the product entered the different machining centers and the inspectors who verified the product at different points along the way. The data structure (control block) may or may not be stored in a database during the manufacturing process. Some application engineers may determine that the data needs to remain in memory to address real-time issues and for speed concerns. On the other hand, the data may be handed off to a database application for archiving. A well defined database links the similar data elements together and provides lookup "keys" that allow subsequent users to view and manipulate the data.


What is an ordered list of data structure using c plus plus?

An ordered list of data in any programming language is simply a sorted array or list. In C++ this can either mean a sorted array, vector, list or forward list.


What does cleverly designed garbage mean?

"Cleverly designed garbage" could refer to an item, a project, a work of art, a plan of action or anything that is being presented as being of value. If someone thinks it has no value, but is merely dressed up or surrounded by fast talk or flashy advertising, they might say, "This is garbage, just cleverly designed garbage."

Related questions

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.


What do you mean by non primitive data structure in C programming?

What do you mean by searching in data structure in C.?


What does the phrase Garbage in Garbage out mean?

The phrase 'garbage in, garbage out' (GIGO) means if the wrong data is entered into a computer system, the information that is produced by the system will also be incorrect.


What does it mean to gather data?

make a collection of data from multiple sources


The collection of data The sum of the data items divided by the number of data items?

The Mean


What is the set data structure?

MEAN


What does PDCT mean?

Portable Data Collection Terminals


What does Garbage in garbage out stands for?

Garbage In, Garbage Out (GIGO) is a phrase that indicates that computers cannot give a right answer if they have the wrong data GIGO can also mean Garbage In Gospel Out as folks believe anything a computer generates


What does it mean to gather?

make a collection of data from multiple sources


What do you mean by ''GIGO'' in computer education?

GI/GO is a computer programming term for Garbage In/Garbage Out. It means that if you have incorrect data input, then your output will be incorrect


What is mean by garbage value?

Garbage value or garbage data is programmers' slang for malformed data, typically with no correlation to the intended or expected value set.For example, a function F might be designed to return a student's name, consisting of a string of readable characters, terminated by a null-bytes. When the function returns unintelligible data instead, data which doesn't form a valid name in any of the supported languages, the data returned by F is said to be garbage data.Note that garbage data is not used to describe incorrect data. If, for example, function F returns the name Smith where Miller might have been the correct answer, function F would suffer from an error and the result data would be erroneous or incorrect, but not garbage.


How does research study is differ from data collection process?

Part of research is observation, measurement and data collection, but research goes further in trying to explain/understand what the data mean, providing insight into how reality works.