memory(int mode): int

Returns the current memory consumption of the script.

Parameters:

mode - 0: Current memory allocation in bytes, including virtual memory and cache pages that have been written to.
   1: Sum of all memory allocations in bytes by functions, price data, and series during the script run.
   2: Current number of allocated memory areas by functions, price data, and series.

Returns:

See mode.

Remarks:

This function was reported not to work properly with mode == 0 under some Windows emulators, such as Wine.

Example:

function run()
{ 
  BarPeriod = 1;
  LookBack = 1;
  ...
  printf("\rMemory %i areas %i kb",memory(2),memory(0)/1024);
  plot("Memory",memory(0),NEW,RED);
}

See Also:

timer

► latest version online