Comparing gc to malloc, Operating System

Garbage collectors trade space for time. If we collect all the time (which requires a lot of processing time), the GC allocator will use the least memory possible. On the other hand, if we have a lot of space to use, we can collect very infrequently and thus be very fast. In general, with enough extra memory, GC can take almost no extra time extra, when compared to explicit memory management. For example, if we are willing to spend 4x more space than usual, garbage collection can run as fast as explicit memory management; if, on the other hand, we don't give it too much space, it will have to run very frequently and thus will demand much more processing time than
explicit memory management.

Faced with this tradeoff, when should we use a garbage collector instead of manual memory management? Generally, use a garbage collector 1) if you have lots of memory; and 2) if we really want to avoid bugs or extra programming effort related to memory management. If, however, hardware resources are the limiting factor and programmer resources are less of a limiting factor, then manual memory management is probably a better idea.

Posted Date: 3/13/2013 3:02:52 AM | Location : United States







Related Discussions:- Comparing gc to malloc, Assignment Help, Ask Question on Comparing gc to malloc, Get Answer, Expert's Help, Comparing gc to malloc Discussions

Write discussion on Comparing gc to malloc
Your posts are moderated
Related Questions
Recall that condition variables are synchronization primitives that enable threads to wait until a particular condition occurs. Generalizing, the combination of locks and condit

Explain what ISAM is. Indexed sequential access method. The file is stored in sorted order. ISAM has a master index file, indicating in what part of another index file the key

Q. Polling for an I/O completion is able to waste a large number of CPU cycles if the processor iterates a busy-waiting loop several times before the I/O completes. However if the

What are the advantages and disadvantages of multithreading?  Advantages : Since by multithreading multiple executions are carried out in the same process environment t

Q. Most WANs utilize only a partially connected topology. Why is this subsequently Answer: Cost. A completely connected network requires a link between every node in the netw

Explain the Communications of Request or Response Interface The inter-application communication must provide four specific interface to the CSInterface() components. A client m

Q. Provide two programming instances in which multithreading provides better performance than a single-threaded solution. Answer: (1) A Web server that services every request


A thread is defined as an independent stream of instructions that can be scheduled to run as such by the operating system. Each program contains a number of threads which can be ru

What are a safe state and an unsafe state? Answer:  A state is safe if the system can allocate resources to every process in some order and still avoid a deadlock. A system is