what is garbage collection in programming language and why C++ lacks this feature. Should i prefer other languages please answer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is garbage collection in programming language and why C++ lacks this feature. Should i prefer other languages please answer

I am a Begineer

24th Oct 2019, 7:05 PM
Sorry
4 Answers
+ 8
Garbage collection automatizes the process of freeing the memory you required on the heap earlier. That is easier to handle and safer, but you have little say about how and when this is done. C and C++ allow you to control things more precisely, but you have to watch out for these things more. In C++, usually classes are defined in a way that they handle this themselves: The instances require the memory and release it when they die. When you use these data types only (like vector, map, array and such) and also use the safe methods, you will hardly feel that there is no garbage collector.
24th Oct 2019, 8:25 PM
HonFu
HonFu - avatar
+ 4
If you are a beginner, a language like C# and Java with auto GC may be easier for you.
25th Oct 2019, 12:10 AM
Sonic
Sonic - avatar
+ 3
it is like HonFu said. it is also one of the reasons a language like C is used a lot for embedded software where memory usage is of utmost importance for you usually have very little of it
24th Oct 2019, 8:35 PM
Brave Tea
Brave Tea - avatar
+ 1
Thanks buddies at some extent i am cleared about this.
25th Oct 2019, 7:54 AM
Sorry