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
Q. Presume an operating system maps user-level threads to the kernel using the many-to-many model and the mapping is done through LWPs. Additionally the system allows developers to

Cold Backup: It is copying the three groups of files when the object is shut down. This is a straight file copy, generally from the storage disk directly to tape. You must end th

Operating Systems have evolved tremendously in the last few decades. The first approach for building Operating Systems, taken during the 40s through early 60s, was to allow only on

Explain the Application Interaction Protocols Application interaction protocols are uniquely defined for each program and are used to logically describe the data being passed b

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

Hashed page tables A common approach for handling address spaces larger than 32 bits is to use a hashed page table. Every entry in the hash table having a linked list of elemen

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

What are the most common schemes for defining the logical structure of a directory? The most common schemes for explaining the logical structure of a directory Single-L

Question 1 Brief the following distributed computing system model Question 2 Explain the components involved in implementation of RPC mechanism Question 3 What is

How is memory management done using bit maps? A bit map is here in this we signify the bit value as 0 or 1. 1-hole 0-process In this we are able to represent the proce