Make MemoryAllocator limits configurable and extensible

Merged
JI
2mo ago
+346-12

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules :cop:.
  • I have provided test coverage for my change (where applicable)

Description

The allocation limits on MemoryAllocator were internal with no public way to raise the 1 GB single-buffer default, and ApplyOptions was not callable from external subclasses, which blocked custom allocators.

  • Expose MemoryGroupAllocationLimitBytes, SingleBufferAllocationLimitBytes, and AccumulativeAllocationLimitBytes with validated protected setters.
  • Make ApplyOptions protected so derived allocators can accept options.
  • Add MemoryAllocatorOptions.SingleBufferAllocationLimitMegabytes to raise the contiguous buffer cap up to 2047 MB without a custom allocator.
  • Add public-api tests that implement a complete external allocator.
  • Add behavior tests for the new option and its validation.