-
|
Is it suggested to dispose |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
|
I suspect it depends on how it is read and whether the underlying buffer is rented from a pool and needs to be returned. My rule of thumb is to always dispose of anything disposable, except for MemoryStream. |
Beta Was this translation helpful? Give feedback.
-
|
It's always suggested to dispose when you are finally done with the request, by loading data into somewhere you manages. Disposing the response will also dispose the stream acquired from
The ways to cause leaks in managed world are very rare. Finalizer will clear heap objects that's not disposed. |
Beta Was this translation helpful? Give feedback.
-
This is an implementation details, and thus could change in the future. |
Beta Was this translation helpful? Give feedback.
-
|
So as a summary, it is a good practice, but nothing bad happens when the Dispose is call is forgotten. |
Beta Was this translation helpful? Give feedback.
I suspect it depends on how it is read and whether the underlying buffer is rented from a pool and needs to be returned. My rule of thumb is to always dispose of anything disposable, except for MemoryStream.