dmd.root.region

Region storage allocator implementation.

Authors

Walter Bright

Source: root/region.d

  • Declaration

    struct Region;

    Simple region storage allocator.

    • Declaration

      nothrow void* malloc(size_t nbytes);

      Allocate nbytes. Aborts on failure.

      Parameters

      size_t nbytes

      number of bytes to allocate, can be 0, must be <= than MaxAllocSize

      Return Value

      allocated data, null for nbytes==0

    • Declaration

      pure nothrow @nogc @safe RegionPos savePos();

      Return stack position for allocations in this region.

      Return Value

      an opaque struct to be passed to release()

    • Declaration

      pure nothrow @nogc @safe void release(RegionPos pos);

      Release the memory that was allocated after the respective call to savePos().

      Parameters

      RegionPos pos

      position returned by savePos()

    • Declaration

      pure nothrow @nogc bool contains(void* p);

      If pointer points into Region.

      Parameters

      void* p

      pointer to check

      Return Value

      true if it points into the region

    • Declaration

      pure nothrow @nogc @safe size_t size();

      Return Value

      size of Region