Why did we limit the command window history length?


In this post: You can hit enter anywhere on the line in the command window, I talked about the command window history.


 


Daniel asked why the size of the history seems to have a limit of around 256K in VFP9, but no limit in VFP7 (or VFP8).


 


 


It was limited to fix this bug report from a customer Oct 2003.


 


Things to notice about the bug report:



  • It’s just code that can be copy/pasted/run with no fuss

  • It’s a bare minimum of code: not multimegabyte files of code (A 4 GigHz processor can execute about a billion instructions per second. Which one of those billions has the problem?)

  • It clearly demonstrates the issue

  • It says what Observed, and Expected behaviors are

 


 


 


 


 


(1) Run these commands from a new .PRG:


 


COPY FILE HOME(7) + [_COMMAND.PRG] TO HOME(7) + [_COMMAND.mine]


STRTOFILE(REPLICATE([MODIFY COMMAND test]+CHR(13)+ ;


      [MODIFY FORM test]+CHR(13)+[? VERSION()]+CHR(13), ;


      199999),HOME(7) + [_COMMAND.BAK])


o = NEWOBJECT([_shellexecute],HOME() + [\ffc\_environ.vcx])


o.shellexecute(HOME(7),HOME(7),[])


 


 


(2) You now have a Windows Explorer window open to your user data directory. Delete _COMMAND.PRG and then rename _COMMAND.BAK to COMMAND.PRG.


(4) Open VFP again...


 


 


=== OBSERVED ===


VFP takes a long time to start and when it does, it is using about 325megs of memory.


 


 


=== EXPECTED ===


Either a linearly increasing memory usage or limiting _command.prg to a sensible size like 1 MB.


 


 


=== COMMENTS ===


To clean up, exit VFP, delete _COMMAND.PRG and rename _command.MINE to _COMMAND.PRG


 


 


 


 


 


 


 


 

Comments (2)

  1. Kent says:

    Hello Calvin,

    When using the Environment Manager Task Pane in VFP9 SP1, how can I get the command window to reload the previous command set when changing from one project to another. Each project is stored in a separate folder with its own foxuser.dbf.

    Thanks,

    Kent

  2. Calvin_Hsia says:

    Hi Kent, Unfortunately, the Command window contents are initialized only when the Command window is first shown. You could perhaps use a project hook to change _command.prg contents and shut/down/restart VFP

Skip to main content