I read this in a Java Text book(SL-275)
Programs that do not de-allocate memory can crash eventually when there is no memory left on the system to allocate. These programs are said to have memory leaks.
Why will there be no memory left? The systems usually have Hundreds Gigabytes of memory and the variable take 2-8 Bytes of data. Lets say we have 1000 undestroyed variables, thats just 8KB.
So why is Garbage collection that important?
I tried searching for the answer on the web and even approached my lecturers but could not find a satisfactory answer.
It is a memory leak if the memory cannot be reclaimed by the system once the program has finished using a variable.
It is important, because,
True war story: I once debugged an ASP .NET system that had a tiny memory leak (I think it was about 60 bytes per request to a particular webpage). But that page was hit a lot, and we had to recycle application pools each hour to avoid exhausting RAM on the server. This was on a very well specced server. It also shows that leaks can even occur in garbage collected environments – we should always be aware of memory consumption.