Sometimes VFP users create programs that are very large. The limit in earlier versions of VFP was about 64k for a compiled program size. VFP9 allows much larger programs.
The code below creates a simple program with a CASE statement, verifies the result, and shows the compiled code size.
In VFP8, I was able to run the code with n=286 (fxp size 61,511) successfully. Anything larger failed with “Program Too Large”
In VFP9, setting n=41,719 (fxp size 8,928,173) succeeded. If I change the ProgCache setting in my config.fpw: PROGCACHE=0, then it would succeed at 1,000,000 (fxp size 214,000,307). Let me know how big you can make it on your machine!
So, programs that are several thousand times larger can be handled by VFP9!
See also SYS(3065) Internal Program Cache
The generated program looks like this for n=2
y=’a’ && this is used in a CASE statement *way* down there
Case Y = ‘a’
y = “a”
set compatible on
IF y=”b” then
cret= “DOCASE:PASS “+TRANSFORM(FSIZE(“tt2.prg”))
cret= “DOCASE:FAIL “+TRANSFORM(FSIZE(“tt2.prg”))
set compatible off
This is the large program code generator:
n=1000000 && 214,000,307
&& VFP8: 286 yields FXP size 61,511. 287 fails
&& VFP9: 41719 yields FXP size 8,928,173. 41720 fails due to ProgCache size
SET TEXTMERGE TO tt2.prg on noshow
\y=’a’ && this is used in a CASE statement *way* down there
\Case Y = ‘a’
FOR i = 1 TO n
FOR i = 1 TO n
\ y = “a”
\set compatible on
\IF y=”b” then
\ cret= “DOCASE:PASS “+TRANSFORM(FSIZE(“tt2.prg”))
\ cret= “DOCASE:FAIL “+TRANSFORM(FSIZE(“tt2.prg”))
\set compatible off
SET TEXTMERGE to