Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MemoryMappedPipeReader Feedback #35

Open
airbreather opened this issue Jun 24, 2019 · 0 comments
Open

MemoryMappedPipeReader Feedback #35

airbreather opened this issue Jun 24, 2019 · 0 comments

Comments

@airbreather
Copy link

airbreather commented Jun 24, 2019

I was playing around with Pipelines.Sockets.Unofficial.MemoryMappedPipeReader this morning, and I'd like to share some feedback from my experience:

  1. Nothing seems to have a finalizer, so those pointers we acquire won't go away unless the consumer explicitly disposes the MemoryMappedPipeReader (ideally, see the remarks and make sure that ReleasePointer is always called in a CER (see CriticalFinalizerObject), though just making sure it's released in a finalizer may be good enough... probably nobody's going to hunt you down if you assume that people won't be regularly aborting threads or unloading app domains).
  2. The return type of MemoryMappedPipeReader.Create does not implement IDisposable, so most people may not even realize that they're supposed to dispose this.
  3. CreateFromFile throws an exception if file.Length is 0... probably just fall back in this case too.
  4. We access the SafeBuffer on UnmanagedMemoryAccessor through reflection (and fall back all the way to the FileStream approach if that's impossible), but wouldn't it be equivalent to go through MemoryMappedViewAccessor.SafeMemoryMappedViewHandle? From my reading of the code, it looks like that would even be the same object instance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant