Wednesday, October 28, 2015

Resource management vs memory management

I am currently reading through the excellent Intro to Rx book.  It is available as a free download from http://www.introtorx.com/.

I found the following the following quote quite useful and worth repeating.

Many people who hear about the Dispose pattern for the first time complain that the GC isn't doing its job. They think it should collect resources, and that this is just like having to manage resources as you did in the unmanaged world. The truth is that the GC was never meant to manage resources. It was designed to manage memory and it is excellent in doing just that. - Krzysztof Cwalina from Joe Duffy's blog.

Of course we are all used to manually closing database connections and file streams.  Still I think it is useful to make the distinction above clear.

No comments:

Post a Comment