Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to track down memory leak(s)
Message
 
 
À
25/09/2011 10:56:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01398453
Message ID:
01524648
Vues:
90
>Yes, - but another important point is appending each time to this.cInvokeFullLog. As it gets bigger it will slow down more
>
>3 possibilities in order of speed
>
>(1) get rid of cInvokeFullLog
>
>(2) write it to another file with fcreate() and fputs()
>
>(3) use an ADO stream

Yes, I agree that cInvokeFullLog may not be needed at all - why not simply check the fsize every time?

BTW, unless I did something wrong my tests are opposite:
LOCAL i, gnErrFile, pnSize, lnSeconds
lnSeconds = SECONDS()
FOR i=1 TO 1000
  STRTOFILE( 'Error information to be written here' + CHR(13) + CHR(10),'errors1.txt', .t.)
NEXT
=MESSAGEBOX(SECONDS() - m.lnSeconds)

lnSeconds = SECONDS()
FOR i=1 TO 1000

IF FILE('errors.txt')  && Does file exist? 
   gnErrFile = FOPEN('errors.txt',12)     && If so, open read/write
   pnSize = FSEEK(gnErrFile,0,2) 
ELSE
   gnErrFile = FCREATE('errors.txt')  && If not create it
ENDIF
IF gnErrFile < 0     && Check for error opening file
   WAIT 'Cannot open or create output file' WINDOW NOWAIT
ELSE  && If no error, write to file
   =FWRITE(gnErrFile , 'Error information to be written here')
ENDIF
=FCLOSE(gnErrFile )     && Close file
NEXT
=MESSAGEBOX(SECONDS() - m.lnSeconds)
Second loop takes longer.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform