EventsBag support for archive.SaveSplit method

Hello @Eugene.Shashkov
If there will be option to dispose the stream right away after use, and then the reference to a stream instance will be released right after that, that should cover all our needs.
That will minimize the number of streams that stay in memory at the moment in time and that is exactly what we need.

Thanks a lot and looking forward for an update.

Hello,
please review the recent changes that suits your needs: CloseEntrySource and DataSource properties.

Hello,

Thank you, we will review this in a little while and will get back to you.

Thanks!

@Eugene.Shashkov I have briefly tested the CloseEntrySource setting, and the behavior is the stream is closed right away, but still not disposed and released until the Archive instance itself is disposed. This way there’s still a possibility for resource leak depending on stream implementation, for example if any internal buffers are not dereferenced upon close (e.g. MemoryStream.Close does not dereference it’s buffer, and it’s memory only released when the stream instance is collected by GC).

This implementation should be good enough in our case though.
Worst case we can wrap the stream into a lightweight wrapper that would fully dispose and dereference the wrapped stream upon close. In this case there will be no significant memory leak, we will just hold to a bunch of shell stream references, which is not too bad.

Thank you. We will work on integration of this into our code in some time.

You are correct, the entry stream is closed, not disposed, if CloseEntrySource flag is set.