Clear Class, Clear Classlib

These two commands remove individual classes and entire class libraries from memory.

Usage

CLEAR CLASS ClassName
CLEAR CLASSLIB ClassLibName
In order to create instances of a class, you have to load the class definition into memory. Even after you destroy the instances, FoxPro keeps the definitions in memory in case you want to make more. These commands free up that memory ... except for one thing.

Neither of these commands works. When you issue either one correctly, you don't see any error messages, but the class or class library is not removed from memory. Use SET CLASSLIB TO without a class library to clear class libraries instead.


Example

SET CLASSLIB TO Connect
oConn = CreateObject('ConnMgr')
* Now work with the Connection Manager
* When you're done, you should be able to do:
CLEAR CLASSLIB Connect
* But nothing happens. You can still
oConn2 = CreateObject('ConnMgr')
With the addition of NewObject() in VFP 6, we think we don't really care whether these commands ever work. We no longer have to use precious memory (maybe not so precious any more, anyway) to load whole class libraries in order to instantiate things. We can just specify the class library on the fly.

See Also

CreateObject(), NewObject(), Release Classlib, Set ClassLib


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .