Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A more definitive statement about MEMORY LEAKS within VF
Message
 
 
To
01/11/1998 12:11:26
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00153253
Message ID:
00153314
Views:
23
Rick,

Second reply. I'm running this code under VFP5 SP3 on a P2-300 with 64meg, Win95 OSR2, machine overnight tonight. On it VFP is capable of instantiating 1,000,000 objects every 100 seconds. So by time morning gets here VFP5a should have worked through 500 million objects. I'll let you know the results of the test in the morning. The timestamp should indicate if there is any detectable slowdown in object instantiation. After the 3rd pass through the loop there is no change in sys(1016) on the first 40,000 iteration test I ran.
dimension laClasses[24]

laClasses[1] = "Form"
laClasses[2] = "Textbox"
laClasses[3] = "Listbox"
laClasses[4] = "Combobox"
laClasses[5] = "Editbox"
laClasses[6] = "Toolbar"
laClasses[7] = "Custom"
laClasses[8] = "Control"
laClasses[9] = "Container"
laClasses[10] = "Shape"
laClasses[11] = "Image"
laClasses[12] = "Label"
laClasses[13] = "CommandGroup"
laClasses[14] = "OptionGroup"
laClasses[15] = "Grid"
laClasses[16] = "Checkbox"
laClasses[17] = "Timer"
laClasses[18] = "Line"
laClasses[19] = "CommandButton"
laClasses[20] = "Spinner"
laClasses[21] = "PageFrame"
laClasses[22] = "Separator"
laClasses[23] = "Cursor"
laClasses[24] = "Relation"
*laClasses[] = ""

clear

set safety off
create table memtest ( iPassCount i, tCreated t, iMemory i )

dimension loObject[ alen( laClasses ) ]

llOk = .t.
lnPass = 0

do while llOk
   insert into memtest values ( lnPass, datetime(), val( sys(1016) ) )
   flush
   llOk = ( inkey() != 32 )
   for i = 1 to alen( laClasses )
      * create one of everything in memory
      loObject[i] = createobject( laClasses[i] )
   endfor
   for i = 1 to alen( laClasses )
      * get rid of them
      loObject[i] = .null.
   endfor
   lnPass = lnPass + 1
   * display current progress on screen
   with _screen
      .CurrentX = 0
      .CurrentY = 0
      .Print( str( lnPass * alen( laClasses ), 20 ) + " Objects" )
   endwith
enddo

browse nowait
>Wow! Sounds like while I was out "trick-or-treating" last night you were busy with that coffee pot. Thanks for all your valuable input. Essentially you have gone through the same iteration that I did when I first discovered my app slowing down. First I put SYS(1016) calculations throughout my code and then step by step removed CREATEOBJECT() or AddObject(). You are correct that SYS(1016) reports can be volatile -- but there is an unmistakeable diminuation of available memory as objects are created and released. As I said earlier, I have "solved" the problem by reuseing objects -- sort of like reuesing records in a .DBF. SYS(1016) is still moving up and down (at least there is downward movement) and available memory is much more consistent now.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform