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 the main difficulty that a programmer must overcome in writing an operating system for a real-time environment? The main difficulty is keeping the operating system with

What does the last four digits '0010' of the above dump represent? What action will the Destination node takes when it receives this packet? The last four digits '0010' denotes

Remote IT Support Engineer Windows Systems Administrator Project Description: Need Windows base IT Support Engineer / Systems Network Administrator - perfectly MCSE qualified

Here are the conditions necessary for a deadlock to occur; note that all of them are necessary, and none is suf?cient: 1. ?nite resources: the resources are held in a mutually-e

what common event leads to the creation of a process?

Q. Explain about Deadlocks? Deadlocks for (int i = 0; i // first find a thread that can finish for (int j = 0; j if (!finish[j]) { boolean temp = true; for

Define the Executor (Worker Thread)  The responsibility of the Executor (or Worker Threads) is to execute instructions on behalf of a client-server connection. The Executor mus

what is the meaning of co-operating process?

LRU approximation page replacement In this we are able to use the reference bit associated with the page entry to choose a page to be removed. The various algorithms used for