[][src]Macro arrayfire::mem_info

macro_rules! mem_info {
    [$msg: expr] => { ... };
}

Macro to print the current stats of ArrayFire's memory manager.

mem_info! print 4 values:

NameDescription
Allocated BytesTotal number of bytes allocated by the memory manager
Allocated BuffersTotal number of buffers allocated
Locked (In Use) BytesNumber of bytes that are in use by active arrays
Locked (In Use) BuffersNumber of buffers that are in use by active arrays

The Allocated Bytes is always a multiple of the memory step size. The default step size is 1024 bytes. This means when a buffer is to be allocated, the size is always rounded up to a multiple of the step size. You can use get_mem_step_size to check the current step size and set_mem_step_size to set a custom resolution size.

The Allocated Buffers is the number of buffers that use up the allocated bytes. This includes buffers currently in scope, as well as buffers marked as free, ie, from arrays gone out of scope. The free buffers are available for use by new arrays that might be created.

The Locked Bytes is the number of bytes in use that cannot be reallocated at the moment. The difference of Allocated Bytes and Locked Bytes is the total bytes available for reallocation.

The Locked Buffers is the number of buffer in use that cannot be reallocated at the moment. The difference of Allocated Buffers and Locked Buffers is the number of buffers available for reallocation.

Parameters

Examples

use arrayfire::{Dim4, device_mem_info, print, randu, mem_info};

let dims = Dim4::new(&[5, 5, 1, 1]);
let a = randu::<f32>(dims);
print(&a);
mem_info!("Hello!");

Sample Output:

AF Memory: Here
Allocated [ Bytes | Buffers ] = [ 4096 | 4 ]
In Use    [ Bytes | Buffers ] = [ 2048 | 2 ]