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

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

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: C#
    • Labels:
      None

      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

          Activity

            People

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

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified