Skip to content

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

Closed

Description

@joshfree

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.

Activity

  1. added this to the milestone on Apr 2, 2018
  2. mairaw commented on Jun 19, 2018

    @mairaw
    Contributor

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

  3. modified the milestones: , on Jun 19, 2018
  4. joshfree commented on Jul 6, 2018

    @joshfree
    MemberAuthor

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

  5. cartermp commented on Sep 3, 2018

    @cartermp
    Contributor

    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.

  6. mairaw commented on Sep 3, 2018

    @mairaw
    Contributor

    @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.

  7. modified the milestones: , on Sep 24, 2018
  8. self-assigned this
    on Oct 4, 2018
  9. modified the milestones: , Sprint 142 (9/24/2018 - 10/12/2018) on Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ⌚ Not Triaged

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions