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
Some people write custom memory allocators to meet their speci?c needs. Although this is not needed for most of the applications, it is also not uncommon. The goal, of course, is t

Essential Properties of Operating System 1. Batch: Jobs with similar needs are batched together and run through the computer as a group by an operator or automatic job sequen

Q. Presume that we agree that 1 kilobyte is 1,024 bytes 1 megabyte is 1,0242 bytes and 1 gigabyte is 1,0243 bytes. This progression carries on through terabytes, petabytes, and ex

Q. Explain the File-system manipulation? File-system manipulation there is several details in file allocation, creation, deletion and naming that users should not have to perfo

Why is rotational latency usually not considered in disk scheduling? How would you modify SSTF, SCAN, and C-SCAN to include latency optimization? Most disks do not export their

How is memory management done using linked lists?   Each one node of the l list will have 4 fields as follows 1-this tells whether it s a hole or a process 2-starting ad

code for implementing NFU page replacement algorithm

ADVANTAGES AND INCONVENIENCES OF KLT Advantages: the kernel be able to simultaneously schedule many threads of the same process on many processors blocking


what do obelia eat and how do they feed