Skip to content

Create usage guidelines for lifetime management of System.Memory<T> #4823

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

Closed
joshfree opened this issue Mar 29, 2018 · 4 comments
Closed

Create usage guidelines for lifetime management of System.Memory<T> #4823

joshfree opened this issue Mar 29, 2018 · 4 comments
Labels
⌚ Not Triaged Not triaged

Comments

@joshfree
Copy link
Member

joshfree commented Mar 29, 2018

Memory, and OwnedMemory are new types shipping in .NET Core 2.1. Memory/OwnedMemory need "rules of the road" usage guidance in order to write code that doesn't cause use-after-free bugs.

https://github.com/dotnet/corefx/issues/23863

https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md

https://github.com/dotnet/corefxlab/blob/master/docs/specs/memory.md

(The below is edited by @GrabYourPitchforks.)

The document at https://gist.github.com/GrabYourPitchforks/4c3e1935fd4d9fa2831dbfcab35dffc6 demonstrates how to think about Memory<T>. It goes over issues related to lifetime and gives a set of guidelines for developers who want to accept Memory<T> instances in their API surface. Read this document first.

The document at https://gist.github.com/GrabYourPitchforks/8efb15abbd90bc5b128f64981766e834 talks about MemoryPool<T> and related types, including how to write custom pools. It also goes over how to change the implementation of Memory<T> to get it to point to new categories of contiguous buffers, such as unmanaged memory. It covers more advanced scenarios.

@mairaw
Copy link
Contributor

mairaw commented Jun 19, 2018

@GrabYourPitchforks @KrzysztofCwalina you both are assigned to this issue. Does that mean you're going to help with the docs? 😄

@mairaw mairaw modified the milestones: 2018 - Quarter 2, 2018 - Quarter 3 Jun 19, 2018
@joshfree
Copy link
Member Author

joshfree commented Jul 6, 2018

@mairaw they've already written the fairly thorough usage guidelines gist above. What's the next step?

@cartermp
Copy link
Contributor

cartermp commented Sep 3, 2018

The next step here would be to turn these gists into docs under (the poorly named) /docs/dotnet/standard folder. Place in the table of contents isn't quite as important, since organic search is where we'd want these to be picked up. It could either be a sub-TOC, or there could be separate articles. I'll leave that preference up to @mairaw.

@mairaw
Copy link
Contributor

mairaw commented Sep 3, 2018

@rpetrusha is currently working on the API docs for for Memory and perhaps could start on this on the next few sprints. It's just that there's a lot going on so we haven't been able to get started on this one yet @joshfree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌚ Not Triaged Not triaged
Projects
None yet
Development

No branches or pull requests

8 participants