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 main advantages of the microkernel approach to system design? Benefits typically contain the following  (a) Adding a new service does not require modifying the

#question.explain varios types of system calls..

Clocks in distributed systems : a. Why are clocks difficult to synchronize in distributed systems? b. What features in a system assume that the clocks are (reasonably) synchr

Q. When a process creates a fresh process using the fork() operation which of the following state is shared among the parent process and the child process? 1 Stack 2 Heap

What is Multitasking? Multitasking provides power to users by offering them to run multiple applications at once. The applications are loaded into memory and appear to the user

Symmetric multiprocessing To get maximum reliability and efficiency a mode of function called as symmetric multiprocessing is used. In essence, with SMP any program or threads

Explain the Real Time Operating System A real-time operating system comprises definite, fixed time constraints. Processing should be done in the defined constraints, or the sys

Explain bounded buffer and unbounded buffer. Here in a producer-consumer problem the producer process produces information that is consumed by a consumer process. At this time

What is contiguous allocation? Allocation of a group of consecutive sectors for a one file.

Explain the Architecting For Threads When available, threads are an integral part of any multitasking server application program. It is important that the operating system prov