LIST PROCEDURES

Sys(3050)

This obscurely named function lets you specify how much memory Visual FoxPro can grab. It has separate settings for foreground memory (when VFP's in control) and background memory (when you leave VFP running while you do something else). The function can also tell you the current settings.

Usage

cMemoryInBytes = SYS(3050, nType [, nMemoryInBytes ] )

Parameter

Value

Meaning

nType

1

Inquire about or change foreground memory.

2

Inquire about or change background memory.

nMemoryInBytes

0

Reset to startup value for your system.

Positive number

Round down to nearest 256K and allow VFP to use that much memory.

cMemoryInBytes

String of digits

The actual amount of memory VFP can use.


FoxPro loves memory—it always has. All other things being equal, FoxPro wants to grab as much memory as it can get. In Windows, that's not always a very nice thing to do. FoxPro 2.x for Windows included the MemLimit setting in the Config.FPW file to put a limit on FoxPro's appetite for memory. MemLimit doesn't do a thing in VFP, but SYS(3050) takes its place. Use it to cap the amount of memory Visual FoxPro can grab (or to let it have more than the default, if you know you won't be running other apps.) Our friend Mac Rubel has spent a lot of time testing VFP's behavior with different amounts of memory. His conclusion is that allocating too much memory can slow things down more than allocating not enough, so watch out with these settings.

Memory is allocated to FoxPro in chunks of 256K bytes. The number you pass to SYS(3050) is rounded down (unless it's less than 256, in which case it's rounded up). Pass the number (or divide the return value) as a multiple of 1024 for "K" or 1024^2 for megabytes.

We haven't figured out yet where VFP gets the initial values. Let us know if you've worked it out.

Example

? SYS(3050,1,2000000)       && Returns 1835008, much too little ? VAL(SYS(3050,1))/1024^2   && Returns 1.75 Mb

See Also

Sys(1001), Sys(1016)


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net