zcsizmadia commented on PR #2439: URL: https://github.com/apache/avro/pull/2439#issuecomment-1677403975
> > * `inStream` and `outStream` memory streams are not in using statement. > > While `using` is a good practice, I don't believe it will have any measurable effect on memory consumption or execution time when used on a `MemoryStream`. Those streams don't hold any unmanaged resources, and `Dispose` won't speed up the garbage collection of the underlying `byte[]`, especially if the `MemoryStream` itself becomes garbage immediately afterwards. In the case of MemoryStream, the using statement is probably is just a good practice, however when disposable object are used in C#, IMO it should be clear how an object is disposed, without knowing hwo the object is implemented underneath the hood or it uses unmanaged objects or not. E.g. it is very trivial to convert a memorystream in->out code to FileStream. And in that case the disposed is mandatory to avoid issues, e.g. files being kept open. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
