Garbage collection, Operating System

The dynamic memory allocator is a layer between the application and the OS, managing heap objects. When a program requests memory from the allocator (via malloc(), for instance), the allocator will return a pointer (or reference) to a piece of memory of the appropriate size. When the program is done with the memory, the memory should be released back to the allocator. Languages such as C and C++ leave this job to the programmer to perform manually, for example by using free(). On the other hand, languages such as Java, python, etc automatically manage dynamically-allocated memory, which makes the programmer's life easier, and can eliminate entire classes of memory management bugs.

Although using free() and delete is relatively simple, it can be tricky to get them right. A signi?cant fraction of bugs in C and C++ programs are related to manual memory management. If we forget to free objects, we end up with memory leaks; if we free memory too soon, we end up with "dangling pointers"; also, we can try to do weird things, like performing double frees, etc. Therefore, a process that manages memory automatically is clearly useful. The most important concept for correctly implementing a garbage collector is that of live objects: a live object is any object that can still be reached through one (or more) pointers.

Posted Date: 3/13/2013 2:50:48 AM | Location : United States







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

Write discussion on Garbage collection
Your posts are moderated
Related Questions
What is bounded buffer

Placement algorithms :calculate where in available real-memory to execute a program. Common functions are next-fit, first-fit, and best-fit. Replacement algorithms :are

What is graceful degradation? In multiprocessor systems, failure of single processor will not halt the system, but only slow it down by sharing the work of failure system by ot

Q. Does Windows XP offer any user-mode processes that enable it to run programs developed for other operating systems? Describe two of these subsystems. Answer: Environmental

How is it different from the unbounded buffer algorithm ? Explain.

Problem 1. List out the conditions that result in Deadlock situations. Illustrate deadlock situation with a simple graphical notation Listing conditions for deadlock occu

The term Operating System (OS) is often misused. It is common, for example, for people to speak of an OS when they are in fact referring to an OS and to a set of additional applica

Q. What is the use of the command interpreter? Why is it generally separate from the kernel? Answer: It reads commands from the user or else from a file of commands and execu

Explain the Peterson's solution for the critical section problem? In Peterson's solution two variables a) flag and b) turn are used as shared variables. If the both shared vari

What is a Dispatcher? The dispatcher is the module that gives control of the CPU to the process selected by the short- term scheduler. This function includes: Switching