answersLogoWhite

0

Garbage collection is a memory management technique where fragmented free memory blocks are coalesced into a smaller number of larger free blocks so as to satisfy a request for memory that is larger than any currently free block.

This is done by moving non-free blocks around. The problem with doing that is that any existing pointers to those blocks become invalid, and need to be updated. Worse, if a thread is making changes to a block, a process called mutation, the act of moving the block can corrupt the block unless the move in done in a thread safe way.

Presently, C and C++ do not support transparent garbage collection. Some vendors have implemented solutions, such as Microsoft's .NET/CLR. As an opposing example, Java is a managed environment also. In any case, using such an infrastructure requires changes to code, and you still need to consider thread safety.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Who performs the garbage collection?

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


What features must a programming language and its runtime environment provide in order to support automatic memory management?

garbage collection


Garbagecolllecter in java?

Yes, Java programming language has a Garbage collector for unused memory. and the best part about it is that it does it automatically. The Garbage Collector is built into the Java Virtual Machine, and will do automatic garbage collection for you. If you chose to compile your Java code down to native code (via a Java->native code compiler), then NO garbage collection is done for you.


How is garbage collection done in c plus plus?

Garbage collection is used to released resources which were previously used by the application(s) which is called garbage collector. Garbage collection allows to prevent memory leaks which are the main problem of old style of programming.


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 does letters gigo stand for?

Regarding computer programming, GIGO means: garbage in, garbage out.


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.


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.


Do dangling references and garbage ever arise in the same programming language?

Dangling references and garbage, otherwise known as memory leaks, can occur in the same application and programming language. These symptoms are evidence of sloppy memory management by the programmer.Dangling references and garbage collection cannot normally occur at the same time, as the garbage collector is not supposed to discard an item so long as there are still any references to it. Therefore, a reference can never "dangle" (i.e. refer to a no longer existing item).