Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FixedSizeMemoryResource

summary

A MemoryResource which allocates memory blocks of a single fixed size using an upstream MemoryResource.

note

Supports only allocations of size smaller than the configured blockSize.

Hierarchy

Index

Constructors

constructor

  • new FixedSizeMemoryResource(upstreamMemoryResource: MemoryResource, blockSize?: number, blocksToPreallocate?: number): FixedSizeMemoryResource
  • summary

    Constructs a MemoryResource which allocates memory blocks of a single fixed size using an upstream MemoryResource.

    Parameters

    • upstreamMemoryResource: MemoryResource

      The MemoryResource from which to allocate blocks for the pool.

    • Optional blockSize: number

      The size of blocks to allocate (default is 1MiB).

    • Optional blocksToPreallocate: number

      The number of blocks to allocate to initialize the pool.

    Returns FixedSizeMemoryResource

Properties

Readonly memoryResource

memoryResource: MemoryResource
summary

The MemoryResource from which to allocate blocks for the pool.

Readonly supportsGetMemInfo

supportsGetMemInfo: boolean
summary

A boolean indicating whether the resource supports the getMemInfo() API.

Readonly supportsStreams

supportsStreams: boolean
summary

A boolean indicating whether the resource supports use of non-null CUDA streams for allocation/deallocation.

Methods

getMemInfo

  • getMemInfo(stream?: number): [number, number]
  • Queries the amount of free and total memory for the resource.

    Parameters

    • Optional stream: number

      the stream whose memory manager we want to retrieve

    Returns [number, number]

    a tuple which contains [free memory, total memory] (in bytes)

isEqual

  • isEqual(other: MemoryResource): boolean
  • summary

    Compare this resource to another.

    remarks

    Two CudaMemoryResource instances always compare equal, because they can each deallocate memory allocated by the other.

    Parameters

    • other: MemoryResource

      The other resource to compare to

    Returns boolean

    true if the two resources are equal, else false