C# Class Accord.Imaging.MemoryManager

Internal memory manager used by image processing routines.

The memory manager supports memory allocation/deallocation caching. Caching means that memory blocks may be not freed on request, but kept for later reuse.

Show file Open project: accord-net/framework

Public Methods

Method Description
Alloc ( int size ) : IntPtr

Allocate unmanaged memory.

The method allocates requested amount of memory and returns pointer to it. It may avoid allocation in the case some caching scheme is uses and there is already enough allocated memory available.

Free ( IntPtr pointer ) : void

Free unmanaged memory.

This method may skip actual deallocation of memory and keep it for future Alloc requests, if some caching scheme is used.

FreeUnusedMemory ( ) : int

Force freeing unused memory.

Frees and removes from cache memory blocks, which are not used by users.

Method Details

Alloc() public static method

Allocate unmanaged memory.
The method allocates requested amount of memory and returns pointer to it. It may avoid allocation in the case some caching scheme is uses and there is already enough allocated memory available.
There is insufficient memory to satisfy the request.
public static Alloc ( int size ) : IntPtr
size int Memory size to allocate.
return System.IntPtr

Free() public static method

Free unmanaged memory.
This method may skip actual deallocation of memory and keep it for future Alloc requests, if some caching scheme is used.
public static Free ( IntPtr pointer ) : void
pointer System.IntPtr Pointer to memory buffer to free.
return void

FreeUnusedMemory() public static method

Force freeing unused memory.
Frees and removes from cache memory blocks, which are not used by users.
public static FreeUnusedMemory ( ) : int
return int