Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.
CLEAR RESOURCES
This command does two things for you. First, it lets your applications see changes to graphics and fonts. Second, it makes VFP give up some of the memory it likes to grab.
CLEAR RESOURCES [ cResourceFile ]
Parameter |
Value |
Meaning |
cResourceFile |
Filename |
Clear the specified item from the cache so that a newer version can be seen. Also releases the memory used by the item. |
Omitted |
Clear all cached items and release the memory they were using. |
One of the tricks VFP uses for doing things fast is to keep the stuff it’s using handy. When a form that involves a bitmap or other picture closes, rather than forgetting about that picture, VFP sticks it in a cache so it’ll be available quickly the next time you need it. (This is much the same as what Internet Explorer does, so that going back to a page is faster than navigating to it in the first place.)
Most of the time, this is what we want. But there are two catches. The obvious one is that saving all that stuff uses up memory space (kind of like all that stuff we have in our houses because “it’s too good to throw out and I might find a use for it”). Eventually, the cache might be taking up more space than you’re willing to give it. CLEAR RESOURCES
lets you clean it out (and it’s a heckuva lot easier than cleaning out our closets and desks). You can clear out the cache entirely by issuing the command without a filename, or just get a specific file out of the way by naming it.
The second issue is more subtle. Suppose you run a form that contains an icon. Then you modify the icon. If the old version is still in the cache, when you run the form again it still shows the old one. (FoxPro does this sort of thing in other places, too. Programs are also cached and sometimes you have to really push to get it to see the latest version.) Again, CLEAR RESOURCES
saves the day. Just specify the file you’ve changed, and it gets dropped from the cache so the new version can be seen.
CLEAR RESOURCES MyFigure.BMP && Clear away a picture to show
&& the latest version.