C# Класс GAudio.GATDataAllocator

Pre-allocates a large float[] to use as virtual memory and avoid any garbage collection. All calls to GATActiveSampleBank and GATReamplingSampleBank GetProcessedSample methods result in a virtual allocation from GATManager's default GATDataAllocator instance.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CleanUp ( ) : void
Defragment ( ) : void

Defragments contiguous free chunks. Automatically called when a chunk of appropriate size cannot be recycled.

Dispose ( ) : void
GATDataAllocator ( InitializationSettings initSettings ) : System

Initializes a new instance of the GATDataAllocator class. In most cases, only the default allocator initialized by GATManager is required.

GetDataContainer ( int size ) : GATData

Finds and virtually allocates a GATManagedData instance before returning it as a GATData reference. First, the algorithm looks at the free chunks bin of appropriate size. If the bin doesn't hold any chunk, it will check if there is enough unfragmented space. If there isn't, it will look at bins holding larger chunks and fragment one if found. Finally, it will attempt defragmenting and run again, before logging an out of memory error.

GetDebugInfo ( ) : List

Gets information regarding each allocated chunk.

GetFixedDataContainer ( int size, string description ) : GATData

Allocates a fixed chunk of memory. Fixed chunks cannot be freed, but may be of any size. For debugging ease, a description is required when requesting a fixed chunk.

GetFixedDebugInfo ( ) : List

Gets information regarding fixed allocations.

NbOfAvailableChunksForSize ( int size ) : int

A conservative estimate of the available number of chunks. Takes into account both unfragmented memory and recyclable previously allocated chunks.

Приватные методы

Метод Описание
AddToFreeChunksBins ( GATManagedData chunk ) : void
Dispose ( bool explicitly ) : void
GetBinIndexForSize ( int size ) : int
GetOrMakeChunk ( ) : GATManagedData
InitCursors ( ) : void
TryFragmentBins ( int fromBinIndex, int binSize, GATManagedData &chunk ) : bool

Описание методов

CleanUp() публичный Метод

public CleanUp ( ) : void
Результат void

Defragment() публичный Метод

Defragments contiguous free chunks. Automatically called when a chunk of appropriate size cannot be recycled.
public Defragment ( ) : void
Результат void

Dispose() публичный Метод

public Dispose ( ) : void
Результат void

GATDataAllocator() публичный Метод

Initializes a new instance of the GATDataAllocator class. In most cases, only the default allocator initialized by GATManager is required.
public GATDataAllocator ( InitializationSettings initSettings ) : System
initSettings InitializationSettings
Результат System

GetDataContainer() публичный Метод

Finds and virtually allocates a GATManagedData instance before returning it as a GATData reference. First, the algorithm looks at the free chunks bin of appropriate size. If the bin doesn't hold any chunk, it will check if there is enough unfragmented space. If there isn't, it will look at bins holding larger chunks and fragment one if found. Finally, it will attempt defragmenting and run again, before logging an out of memory error.
public GetDataContainer ( int size ) : GATData
size int /// Size of the chunk to virtually allocate. ///
Результат GATData

GetDebugInfo() публичный Метод

Gets information regarding each allocated chunk.
public GetDebugInfo ( ) : List
Результат List

GetFixedDataContainer() публичный Метод

Allocates a fixed chunk of memory. Fixed chunks cannot be freed, but may be of any size. For debugging ease, a description is required when requesting a fixed chunk.
public GetFixedDataContainer ( int size, string description ) : GATData
size int
description string
Результат GATData

GetFixedDebugInfo() публичный Метод

Gets information regarding fixed allocations.
public GetFixedDebugInfo ( ) : List
Результат List

NbOfAvailableChunksForSize() публичный Метод

A conservative estimate of the available number of chunks. Takes into account both unfragmented memory and recyclable previously allocated chunks.
public NbOfAvailableChunksForSize ( int size ) : int
size int
Результат int