Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-5277

[C#] MemoryAllocator.Allocate(length: 0) should not return null

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 0.16.0
    • C#

    Description

      See the conversation here.

      We should change MemoryAllocator to not return `null` when the requested memory length is `0`. Instead, we should create a cached "NullObject" IMemoryOwner that has a no-op `Dispose` method, and always returns `Memory<T>.Empty`.

      This way consuming code doesn't need to check for `null` being returned from MemoryAllocator.Allocate.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              eerhardt Eric Erhardt
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 24h
                  24h
                  Remaining:
                  Time Spent - 0.5h Remaining Estimate - 23.5h
                  23.5h
                  Logged:
                  Time Spent - 0.5h Remaining Estimate - 23.5h
                  0.5h