Article ID: 176765
Article Last Modified on 5/10/2003
LOCAL ARRAY laIcons[1,1]
LOCAL loForm, lnI, lnFile, lnFiles
loForm = CREATEOBJECT('Form')
loForm.HEIGHT = 600
loForm.WIDTH = 200
FOR lnI = 1 TO 10
loForm.ADDOBJECT('imgObject' + ALLTRIM(STR(lnI)), 'Image')
WITH loForm.CONTROLS[lnI]
.LEFT = 10
.TOP = 10 + (lnI ) * 50
.WIDTH = 25
.HEIGHT = 25
.VISIBLE = .T.
ENDWITH
ENDFOR
loForm.ADDOBJECT('lblCounter', 'Label')
loForm.lblCounter.TOP = 1
loForm.lblCounter.LEFT = 1
loForm.lblCounter.AUTOSIZE = .T.
loForm.lblCounter.VISIBLE = .T.
loForm.SHOW()
lnFiles = ADIR(laIcons, HOME() ;
+ 'SAMPLES\GRAPHICS\ICONS\COMPUTER\*.ICO')
FOR lnI = 1 TO 1000
loForm.lblCounter.CAPTION = 'Loop :' + PADL(lnI, 4)
FOR lnFile = 1 TO lnFiles - 10
loForm.CONTROLS[ 1].PICTURE = ;
HOME() + 'SAMPLES\GRAPHICS\ICONS\COMPUTER\' + laIcons[lnFile , 1]
loForm.CONTROLS[ 2].PICTURE = ;
HOME() + 'SAMPLES\GRAPHICS\ICONS\COMPUTER\' + laIcons[lnFile+1, 1]
loForm.CONTROLS[ 3].PICTURE = ;
HOME() + 'SAMPLES\GRAPHICS\ICONS\COMPUTER\'+ laIcons[lnFile+2, 1]
loForm.CONTROLS[ 4].PICTURE = ;
HOME() + 'SAMPLES\GRAPHICS\ICONS\COMPUTER\'+laIcons[lnFile + 3, 1]
loForm.CONTROLS[ 5].PICTURE = ;
HOME() + 'SAMPLES\GRAPHICS\ICONS\COMPUTER\'+laIcons[lnFile + 4, 1]
loForm.CONTROLS[ 6].PICTURE = ;
HOME() + 'SAMPLES\GRAPHICS\ICONS\COMPUTER\'+laIcons[lnFile + 5, 1]
loForm.CONTROLS[ 7].PICTURE = ;
HOME() + 'SAMPLES\GRAPHICS\ICONS\COMPUTER\'+laIcons[lnFile + 6, 1]
loForm.CONTROLS[ 8].PICTURE = ;
HOME() + 'SAMPLES\GRAPHICS\ICONS\COMPUTER\' + laIcons[lnFile+7, 1]
loForm.CONTROLS[ 9].PICTURE = ;
HOME()+'SAMPLES\GRAPHICS\ICONS\COMPUTER\' + laIcons[lnFile + 8, 1]
loForm.CONTROLS[10].PICTURE = ;
HOME()+'SAMPLES\GRAPHICS\ICONS\COMPUTER\' + laIcons[lnFile + 9, 1]
IF INKEY(0.001, 'HM') = 27
CANCEL
ENDIF
ENDFOR
ENDFOR
The first indication of a memory problem appears when the icons no longer
appear in the individual image objects. The number of iterations before
this symptom appears depends on the amount of physical RAM installed on the
computer. Once the memory leak consumes all the physical RAM, Visual FoxPro
begins using virtual memory. At this point, performance suffers greatly and
the operating system may lock.
Keywords: kbbug kbfix KB176765