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.
Yes, I have come across libraries that do just that. Of the top of my head I cannot tell you where to look.
Answer: No. In C you cannot decide weather a piece of memory is still in use, or not. Of course you can write your own allocation/deallocation functions, with a 'deallocate everything' function.
C plus plus does not have a built-in garbage collector; you would need to write your own.
There is no garbage collection in C
No such thing.
Yes, GC can be considered as a JVM utility that checks the status of memory objects and cleans up all unused memory references so that, this memory can be used by other objects.
Of course.
Initialization. Hint: your compiler might warn you, neverignore warnings if you aren't absolutely sure what they mean.
No.
D essentially evolved from practical usage of C++ and added features found in other languages including C#, Eiffel, Java, Python and Ruby. D has garbage collection, design by contract, unit testing, true modules, first class arrays, associative arrays, dynamic arrays, array slicing, nested functions, inner classes, closures, anonymous functions, compile time function execution, lazy evaluation, a re-engineered template syntax and integrated inline assembler.
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.
Yes, GC can be considered as a JVM utility that checks the status of memory objects and cleans up all unused memory references so that, this memory can be used by other objects.
Nothing. In C++ you could write a C compiler. So, everything that can be done with C, can be also done in C++.
C and C++ programming is good for embedded programming. However, embedded implies long running, and that means the possibility of memory fragmentation. You will need to spend time working out or acquiring a method of memory management, such as the use of Smart Pointers and Garbage Collection. This is not a trivial task, but it is a necessary task.
Of course.
Initialization. Hint: your compiler might warn you, neverignore warnings if you aren't absolutely sure what they mean.
No, C++ does not use dynamic memory management. The programmer is entirely responsible for releasing dynamic memory when it is no longer required. When static objects fall from scope, their destructors are called automatically, but there is no automatic garbage collection for dynamic objects. Allocated memory remains allocated until the programmer manually releases it, or the thread that owns the memory is terminated.
It is possible, however there are many caveats. For instance, Java utilises built-in garbage collection whereas C++ does not, so the resulting C++ will leak resources massively. The converted code should really be viewed as being a starting point -- you will have to manually edit the code in order to address all the problems created by the conversion. For a non-trivial application, manually editing the code would be highly prone to error.
No.
Garbage collection is a memory management technique where fragmented free memory blocks are coalesced into a smaller number of larger free blocks so as to satisfy a request for memory that is larger than any currently free block. This is done by moving non-free blocks around. The problem with doing that is that any existing pointers to those blocks become invalid, and need to be updated. Worse, if a thread is making changes to a block, a process called mutation, the act of moving the block can corrupt the block unless the move in done in a thread safe way. Presently, C and C++ do not support transparent garbage collection. Some vendors have implemented solutions, such as Microsoft's .NET/CLR. As an opposing example, Java is a managed environment also. In any case, using such an infrastructure requires changes to code, and you still need to consider thread safety.
Initialization of objects means to provide an initial value for the object. This is usually done by the constructor, or it can be done with an assignment statement.
It must be done by a platform-dependent function, it's "clrscr" from conio.h in TurboC