What is a memory leak? (Part 2) – Disposing Objects – Unmanaged Resources

_config.yml

Garbage collection. A very important job in our society. They also perform a very important job in computing

What is a memory leak? The Disposal of Objects. Unmanaged Resources.

Last post we went over what a memory leak is. Basically it’s when you hoard something in your house when you don’t have a good need for it. And we touched on another issue: unmanaged resources. What’s that? An unmanaged resources is anything in your house that the garbage collector does not know about. The garbage collector, like Santa, likes to keep records of every single thing in your house. Not for income tax purposes, but knowing how human beings are – he wants to dispose of as much useless junk in your house, as soon as possible. Otherwise your house will soon become so cluttered that you won’t be able to move around in it. Yes, he’s a kind soul. The Garbage collector likes to keep track over everything. And if he finds out you don’t need something – guess what? He’ll come knocking on your door asking to dispose it.

Unmanaged Resources

So you like to occasionally smoke a few, shall we say, cigarettes. Your wife disapproves of it. You want to keep it all hush-hush so you don’t tell the garbage collector and definitely not the cops. You don’t tell anyone. You never know who’ll dob you in. Knowing this, your mate Pablo calls you up, asking for permission to warehouse some goodies. You’re like: “sure thing bro!”. And before you know it, you’ve got a mountain of goodies in your house. It’s taking up a looooot of space. It’s getting difficult to walk around your house and invite people over. The garbage collector doesn’t come knocking because he doesn’t know that your warehousing Pablo’s Coca Cola collection. It’s all worth it if you’ve got some use for the goods. But if you’ve got no use for them, well you’re cluttering up everything in your house for no benefit.

In other words, if you put something in your house without the garbage collector knowing about it (this is an unmanaged object) you are the one responsible for it and *you are the one responsible for disposing it. When you dispose of an object you are basically cleaning your house, making it more spacious. In other words you’d be able to utilize the room for other things: to put in a dining table etc.

Basically, if you’re dealing with unmanaged goods then you definitely need to dispose of it when you are done. If you don’t then things ain’t gonna be efficient for you.

Written on December 20, 2016