Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP bug - SetAll increases memory usage
Message
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00521269
Message ID:
00521534
Views:
17
This message has been marked as the solution to the initial question of the thread.
Nadya,

I have a couple of problems with the code you posted. Mostly it doesn't really isolate the memory usage to the SetAll, in that test the memory can have easily been disappearing in the WAIT WINDOW, the ltrim(), the str() and/or the sys() calls.

This code more specifically isolates only the SetAll:
Local i, cOldValue, cEndValue

cOldValue = sys(1016) 

For i = 1 To 1500 && 000 
    ThisForm.SetAll("ToolTipText", "Test memory", 'Textbox') 
Next 

cEndValue = sys(1016)

activate screen
? "Used memory before SetAll: " + cOldValue + " Now: " + cEndValue
Now running this test I see memory usage increasing by 90k per execution VFP6 SP3. But There are still other possible places that need to be tested. Is it the SetAll itself or the ToolTipText that's causing the problem?
Local i, cOldValue, cEndValue

cOldValue = sys(1016) 

For i = 1 To 1500 && 000 
    ThisForm.SetAll("backcolor", i, 'Textbox') 
Next 

cEndValue = sys(1016)

activate screen

? "Used memory before SetAll backcolor: " + cOldValue + " Now: " + cEndValue
This test shows that SetAll() working on the BackColor property doesn't so any increase in memory use when run repeatedly.

So does manipulating the ToolTipText cause the problem?
Local i, cOldValue, cEndValue

cOldValue = sys(1016) 

For i = 1 To 1500 && 000 
   for each loObject in this.Objects
      if ( loObject.BaseClass = 'textbox' )
         loObject.ToolTipText = "Test memory"
      endif
   endfor
Next 

cEndValue = sys(1016)

activate screen

? "Used memory before foreach: " + cOldValue + " Now: " + cEndValue
This also doesn't show a significant memory increase. It actually shows a small memory usage decrease in a couple of runs. Although it's much slower than SetAll()

Bottomline on these kinds of tests care must be taken to ensure that the code is indeed testing what you think it's testing. FWIW I do not see the increased memory usage in the VFP7 beta.

>I'm reading an interesting Russian VFP site right now: www.nsvisual.com.fox2
>
>and here I found a problem, which I just reproduced:
>
>Create a form with several textboxes and a command button. Put this code in command button click event:
>
>Local i, cOldValue
>cOldValue = sys(1016)
>* Than the string passed to SetAll is longer, than the effect is more noticable
>
>For i = 1 To 1500000
>    ThisForm.SetAll("ToolTipText", "Test memory", 'Textbox')
>    wait window Ltrim(str(i)) + " - " + sys(1016) nowait
>Next
>messagebox("Used memory before SetAll: " + cOldValue + " Now: " + sys(1016))
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