Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PoolMemoryResource

summary

A coalescing best-fit suballocator which uses a pool of memory allocated from an upstream MemoryResource.

Hierarchy

Index

Constructors

constructor

  • new PoolMemoryResource(upstreamMemoryResource: MemoryResource, initialPoolSize?: number, maximumPoolSize?: number): PoolMemoryResource
  • summary

    Constructs a coalescing best-fit suballocator which uses a pool of memory allocated from an upstream MemoryResource.

    Parameters

    • upstreamMemoryResource: MemoryResource

      The MemoryResource from which to allocate blocks for the pool.

    • Optional initialPoolSize: number

      Initial pool size in bytes. By default, an implementation-defined pool size is used.

    • Optional maximumPoolSize: number

      Maximum size in bytes, that the pool can grow to.

    Returns PoolMemoryResource

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