User Tools

Site Tools




As explained on the memory management page, xff stores the actual content of objects in a global variable, which means that the statement

clear obj;

does not have the desired effect of clearing (freeing) the memory associated with the variable (object) obj. Instead, the memory must be freed using a class/object method (which in turn removes the object's content from the global variable).

Reference ('obj.Help('ClearObject')')

 AFT::ClearObject  - remove object from global storage
 FORMAT:       obj.ClearObject;
 No input / output fields.

Usage example

% creating a temporary SDM
sdm = xff('new:sdm');
% adding filters
sdm.AddFilters(struct('number', 3, 'timepts', 120));
% getting filter regressors
filterregs = sdm.SDMMatrix;
% clearing object to free associated memory!!


While xff does support garbage collection, this does not affect objects that

  • have been created in the BASE workspace (which includes objects created in batch M-files, as long as this batch file was called from the BASE workspace, i.e. the console)
  • have been blessed using the bless(obj); or bless(obj, levels); call

Also, the garbage collection is called only when a method on any given xff object is used; so it can sometimes take a while before memory becomes available again. In general, it is highly suggested that you clear objects once you know they are no longer required to free up the memory they allocate!

obj.clearobject.txt · Last modified: 2010/06/12 04:26 by jochen