Conservative garbage collection, Operating System

Conservative GC can be used for languages such as C and C++, which were not explicitly designed for garbage collection. This is a non-copying technique. A conservative garbage collector is one that, instead of knowing the exact location of each object, discovers the set of live objects by scanning a region of memory, looking for areas that may be objects. Because C and C++ allow casting, anything that can hold a pointer could conceivably be a pointer, such as an unsigned long which is cast as a pointer, or a ?oating-point type which is cast as a pointer, etc. Conservative GC more or less uses the "duck test", paraphrased here as "if it looks like a pointer and acts like a pointer, it's probably a pointer". Starting from the roots, we can ?nd all objects which look like pointers, and the objects to which they would point if they were in fact pointers, and mark those objects as live. By doing this, we can provide garbage collection to languages which otherwise would not support it.

The possible objects found may or may not actually be objects, but we are ensured that all live objects referred to from that particular area are found by the garbage collector. Since we must discover the areas that might be objects, we also have to know how to identify pointers; usually, if something looks like a pointer, we assume it is a pointer. Then, conservative GC traces through those "pointers", marking everything that is still live.

Some of the drawbacks of this method are: 1) areas of memory that look like pointers to objects, but aren't, cause garbage objects to be retained as long as the fake pointer exists; this increases memory usage of the garbage collector, and can cause other limited resources to be exhausted; and 2) the methods of ?nding exactly which areas to trace aren't always portable.

Posted Date: 3/13/2013 3:01:13 AM | Location : United States







Related Discussions:- Conservative garbage collection, Assignment Help, Ask Question on Conservative garbage collection, Get Answer, Expert's Help, Conservative garbage collection Discussions

Write discussion on Conservative garbage collection
Your posts are moderated
Related Questions
What are the drawbacks of contiguous allocation of disk space? The disadvantages are a. Suffers from internal fragmentation b. Suffers from external fragmentation c. F

What are files and explain the access methods for files? File definition Attributes, operations and types Direct access Sequential access with diagram Other access

Question : a) Consider table 1.0 below, assume the processes arrived in the order P 1 , P 2 , P 3 , P 4 at time shown and need the indicated burst time (both in milliseconds)

What are batch systems? Early computers were physically huge machines run from a console. The general input devices were card readers and tape drivers. The common output device

Q. Why might a system utilize interrupt-driven I/O to manage a single serial port however polling I/O to manage a front-end processor such as a terminal concentrator? A

Q. The accelerating search for described in subsequent exercise is typical of hard-disk drives. By contrast floppy disks and several hard disks manufactured before the mid-1980s t

Explain the Fork Function Fork function causes a new process to be created. The calling progress is duplicated as an exact copy (called the child process) that differs only in

basic advantage of using interrupt initiated data transfer over transfer under program control without an interrupt

Q. What are two dreadful problems that designers should solve to implement a network-transparent system? Answer: One such issue is making all the processors as well as storag

Many early operating systems regarded processes as different timesharing users. The process abstraction is a popular way to organize concurrent programs, but it is not the only cho