Logo

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.

Sys(1104)

This function purges the cached memory.

Usage

nSuccess = SYS( 1104 )

This function has been around a while, but finally entered the documentation in VFP 7 (in fact, for VFP 6, Microsoft actually documents it as undocumented in the Knowledge Base article Q269284). It flushes the buffers called by programs and data. Since VFP takes advantage of all available memory, freeing up memory with SYS(1104) can really boost performance. If performance isn’t what you think it could be, call this function after any commands that extensively use buffers, such as SQL statements or changes to large tables.

This function returns 0 if successful.

Not only can executing this function increase performance by freeing up memory, it can also force changes to appear when writing data to disk. Occasionally, after issuing a FLUSH, with REFRESH set to a very low, non-zero value, changes still aren’t reflected for a few seconds, particularly in multi-user environments. In many cases, issuing SYS(1104) after FLUSH can fix the problem.

Example

SET REFRESH TO 1
* A change to a large table goes here, perhaps some sort
* of batch update.
FLUSH
SYS(1104)

See Also

Flush, Set Refresh, Sys()