www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@xregpointer/freeptr.m

    function varargout = freeptr(p)
%FREEPTR Frees heap which p points to
%
%  FREEPTR(P) releases the memory that P is pointint to.  Note that freeptr
%  is called on P.info as a destructor.

%  Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc.


if all(p.ptr~=0)
    % call free for pointer info
    % there is a blank free classless function
    HeapManager(5,p.ptr);
    if nargout
        p.ptr=0;
        varargout{1}=p;
    end
end