answersLogoWhite

0

Why c plus plus does not have garbage collector?

Updated: 8/20/2019
User Avatar

Wiki User

6y ago

Best Answer

Although the C++ standard does not provide a garbage collector, there's nothing to stop you from using one. There are many garbage collection libraries available, or you can write your own.

However, garbage collection is not required in C++ because correct use of resource handles and smart pointers ensures there is never any garbage to collect. More importantly, resource handles and smart pointers incur little to no overhead. Shared resource handles do incur some cost, but that cost is negligible compared to the cost of managing shared resources through "naked" C-style pointers, let alone the cost of garbage collection.

User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why c plus plus does not have garbage collector?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

In c garbage collector?

No.


How is garbage collection done in c plus plus?

Garbage collection is used to released resources which were previously used by the application(s) which is called garbage collector. Garbage collection allows to prevent memory leaks which are the main problem of old style of programming.


How garbage collector works on anonymous class in java?

about the garbage collector it is in java and it is mainly responsible for dynamic memory manegement


Who performs the garbage collection?

A garbage truck. In computer programming, a process known as the garbage collector.


What actors and actresses appeared in The Garbage Collector - 2010?

The cast of The Garbage Collector - 2010 includes: Justin Huen Jamie Wollrab


How much does a garbage collector make in Orlando fl?

In Orlando, Florida, the average annual income for a garbage collector is $23,000. The average annual income for a garbage collector in Jackson, Tennessee is $25,000.


What is mean by garbage?

Garbage collected means that the memory used by an object has been reclaimed by the garbage collector.


What are those people called when they the pick up rubbish bins?

They are called bin men. Dustman, garbage carter, garbage collector, garbage hauler, garbage man, garbageman, garbo, refuse collector


What is a euphemism for garbage collector?

Trash man


Memorymically and and not reclaming it when it is no longer it is needed in java there is no such problem as there is as garbage collector what is it?

I guess you want to talk about the garbage collector feature that Java has. The garbage collector is an automated program that the Java virtual machine would run once in a while. This program would clean up unused memory to ensure that there is enough memory available for the programs. you can invoke the garbage collector by calling the system.gc() method but this does not guarantee an invocation of the garbage collector. the JVM may or may not call the GC when we invoke it...


How do you write a Program on garbage collector in java?

Garbage collection is an operation that happens automatically in Java. We cannot write programs to perform them. All we can do is call the system's implementation of the Garbage collector and hope that it would execute. "Runtime.gc();" Place the above piece of code in your code, if you want to invoke the garbage collector. Invoking the runtime's implementation of the gc does not guarantee the execution of the garbage collector. It may or may not run. The JVM decides on that.


What is mean by garbage collected?

Garbage collected means that the memory used by an object has been reclaimed by the garbage collector.