IMatrixEx.MemoryUsed

Syntax

MemoryUsed: Double;

Description

The MemoryUsed property returns an approximate amount of memory used by matrix in bytes.

Comments

An approximate memory size is based on the fact that some collections used in matrixes do not return information about the amount of used or allocated memory.

Example

Executing the example requires that the repository contains a cube with the CUBE identifier.

Add links to the Cubes, Dimensions, Matrix, Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Cube: ICubeInstance;
    Dest: ICubeInstanceDestination;
    Dests: ICubeInstanceDestinations;
    SelSet: IDimSelectionSet;
    Exec: ICubeInstanceDestinationExecutor;
    MatrixEx: IMatrixEx;
    Option: Integer;
    i: integer;
Begin
    // Get repository data
    MB := MetabaseClass.Active;
    // Get cube instance
    Cube := MB.ItemById("CUBE").Open(NullAs ICubeInstance;
    // Set default cube display version
    Dests := Cube.Destinations;
    Dest := Dests.DefaultDestination;
    // Add all elements of all cube dictionaries to selection
    SelSet := Dest.CreateDimSelectionSet;
    For i := 0 To SelSet.Count - 1 Do
        SelSet.Item(i).SelectAll;
    End For;
    // Calculate cube
    Option := CubeInstanceDestinationExecutorOptions.None;
    Exec := Dest.CreateExecutorO(Option);
    Exec.PrepareExecute(SelSet);
    Exec.PerformExecute(True);
    // Display information about memory used by output matrix
    MatrixEx := Exec.Matrix As IMatrixEx;
    Debug.WriteLine("Allocated memory: " + MatrixEx.MemoryReserved.ToString + " bytes");
    Debug.WriteLine("Used memory: " + MatrixEx.MemoryUsed.ToString + " bytes"); 
End Sub UserProc;

After executing the example, all cube elements are selected, after which the cube is calculated and the development environment console displays information about allocated and used memory of the output matrix.

The example of the console with displayed information:

Allocated memory: 13352 bytes

Used memory: 10160 bytes

See also:

IMatrixEx