C# Class 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.
Inheritance: IDisposable
Afficher le fichier Open project: gregzo/G-Audio Class Usage Examples

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
AddToFreeChunksBins ( GATManagedData chunk ) : void
Dispose ( bool explicitly ) : void
GetBinIndexForSize ( int size ) : int
GetOrMakeChunk ( ) : GATManagedData
InitCursors ( ) : void
TryFragmentBins ( int fromBinIndex, int binSize, GATManagedData &chunk ) : bool

Method Details

CleanUp() public méthode

public CleanUp ( ) : void
Résultat void

Defragment() public méthode

Defragments contiguous free chunks. Automatically called when a chunk of appropriate size cannot be recycled.
public Defragment ( ) : void
Résultat void

Dispose() public méthode

public Dispose ( ) : void
Résultat void

GATDataAllocator() public méthode

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
Résultat System

GetDataContainer() public méthode

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. ///
Résultat GATData

GetDebugInfo() public méthode

Gets information regarding each allocated chunk.
public GetDebugInfo ( ) : List
Résultat List

GetFixedDataContainer() public méthode

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
Résultat GATData

GetFixedDebugInfo() public méthode

Gets information regarding fixed allocations.
public GetFixedDebugInfo ( ) : List
Résultat List

NbOfAvailableChunksForSize() public méthode

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
Résultat int