Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How does VFP load class methods into memory?
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01434853
Message ID:
01434935
Views:
49
>>>
>>>I believe so - see point #2
>>>
>>>
>>>http://fox.wikis.com/wc.dll?Wiki~VisualFoxproInvocationStack
>>
>>Thank you for your help.
>
>I've tested it right now - in my case original instantiation of relation class took longer than 100 objects instantiation:
>
>
>
>
>CLEAR ALL
>CLEAR
>SET procedure TO Common_utility.prg
>PRIVATE lcOutFile
>lcOutFile= [Test_memory_create_destroy_] + subs(version(),16,1) + [.TXT]
>SET ALTERNATE TO &lcOutFile
>SET ALTERNATE ON
>
>? 'Source Generated by Speed.prg at ' + TRANSFORM(DATETIME())
>? 'Source: ', 'Test_memory_create_destroy.PRG', VERSION()
>? 'Run Date: '+ TTOC( DATETIME())
>#DEFINE cnNumObj  1
>LOCAL i, lnTime1, lnTime2, lnTime3, nMem1, nMem2
>lnTime1=SECONDS()
>lnTime2=SECONDS()
>lnTime3=SECONDS()
>nMem1=INT(VAL(SYS(1016)))
>nMem2=INT(VAL(SYS(1016)))
>? 'Col 1: Number of Objects'
>? 'Col 2: Object Class'
>? 'Col 3: Memory required'
>? 'Col 4: Seconds to create ' + ALLTRIM(STR(cnNumObj,5)) + ' objects'
>? 'Col 5: Seconds to destroy '+ ALLTRIM(STR(cnNumObj,5)) + ' objects'
>? 'Col 6: Tot time, Col(5)+Col(4)'
>
>? PADR('Num',5), PADR('Class',20), PADL('Memory',10), ;
>     PADL('Create',10), PADL('Destroy',10), PADL('Total',10)
>? PADR('===',5), PADR('=====',20), PADL('======',10), ;
>     PADL('======',10), PADL('=======',10), PADL('=====',10)
>=LogFunc('Age')
>#UNDEF cnNumObj
>#DEFINE cnNumObj  100
>=LogFunc('Age')
>*!*	=LogFunc('MyColumnSub1')
>*!*	=LogFunc('MyComboBoxSub1')
>*!*	=LogFunc('MyCommandButtonSub1')
>*!*	=LogFunc('MyCommandGroupSub1')
>*!*	=LogFunc('MyContainerSub1')
>*!*	=LogFunc('MyControlSub1')
>*!*	=LogFunc('MyCursorSub1')
>*!*	=LogFunc('MyCustomSub1')
>*!*	=LogFunc('MyDataenvironmentSub1')
>*!*	=LogFunc('MyEditBoxSub1')
>*!*	=LogFunc('MyFormSub1')
>*!*	=LogFunc('MyFormSetSub1')
>*!*	=LogFunc('MyFormSetSub2')
>*!*	=LogFunc('MyGridSub1')
>*!*	=LogFunc('MyHeaderSub1')
>*!*	=LogFunc('MyImageSub1')
>*!*	=LogFunc('MyLabelSub1')
>*!*	=LogFunc('MyLineSub1')
>*!*	=LogFunc('MyListBoxSub1')
>*!*	=LogFunc('MyOptionButtonSub1')
>*!*	=LogFunc('MyOptionGroupSub1')
>*!*	=LogFunc('MyPageSub1')
>*!*	=LogFunc('MyPageFrameSub1')
>*!*	=LogFunc('MyRelationSub1')
>*!*	=LogFunc('MyRelationSub2')
>*!*	=LogFunc('MySeparatorSub1')
>*!*	=LogFunc('MySessionSub1')
>*!*	=LogFunc('MyShapeSub1')
>*!*	=LogFunc('MySpinnerSub1')
>*!*	=LogFunc('MyTextBoxSub1')
>*!*	=LogFunc('MyTimerSub1')
>*!*	=LogFunc('MyToolBarSub1')
>*!*	=EmptyTest('Empty')
>
>********************************
>FUNCTION LogFunc(tcClass)
>
>#IFDEF DOSYS1104
>	SYS(1104)
>#ENDIF
>
>WAIT WINDOW NOWAIT PADL(tcClass,20)
>DIMENSION aBin[cnNumObj]
>nMem1=INT(VAL(SYS(1016)))
>lnTime1=SECONDS()
>FOR i=1 TO cnNumObj
>  aBin[i]=CREATE(tcClass)
>ENDFOR
>lnTime2=SECONDS()
>nMem2=INT(VAL(SYS(1016)))
>RELEASE aBin
>lnTime3=SECONDS()
>SET ALTERNATE TO  &lcOutFile ADDITIVE
>SET ALTERNATE ON
>? PADR(cnNumObj,5), PADR(tcClass,20), PADL(nMem2-nMem1,10), ;
>     PADL(lnTime2-lnTime1,10), PADL(lnTime3-lnTime2,10), PADL(lnTime3-lnTime1,10)
>SET ALTERNATE TO
>SET ALTERNATE OFF
>
>******************
>
>FUNCTION EmptyTest(tcClass)
>#IFDEF DOSYS1104
>	SYS(1104)
>#ENDIF
>#IFDEF BINDEVENTTEST
>	loObjectToBindTo = CreateObject("MycusHandler1")
>#ENDIF
>WAIT WINDOW NOWAIT PADL(tcClass,20)
>DIMENSION aBin[cnNumObj]
>nMem1=INT(VAL(SYS(1016)))
>lnTime1=SECONDS()
>FOR i=1 TO cnNumObj
>  aBin[i]=CREATE(tcClass)
>  #IFDEF ADDPROPERTYTEST
>    AddProperty(aBin[i],"Prop1")
>  #ENDIF
>ENDFOR
>lnTime2=SECONDS()
>nMem2=INT(VAL(SYS(1016)))
>RELEASE aBin
>lnTime3=SECONDS()
>SET ALTERNATE TO &lcOutFile ADDITIVE
>SET ALTERNATE ON
>? PADR(cnNumObj,5), PADR(tcClass,20), PADL(nMem2-nMem1,10), ;
>     PADL(lnTime2-lnTime1,10), PADL(lnTime3-lnTime2,10), PADL(lnTime3-lnTime1,10)
>SET ALTERNATE TO
>SET ALTERNATE OFF
>ENDFUNC
>
>*****************
>
>DEFINE CLASS MyCheckBoxSub1 AS CheckBox
>  Name= 'MyCheckBoxSub1'
>ENDDEFINE
>
>DEFINE CLASS MyColumnSub1 AS Column
>  Name= 'MyColumnSub1'
>ENDDEFINE
>
>DEFINE CLASS MyComboBoxSub1 AS ComboBox
>  Name= 'MyComboBoxSub1'
>ENDDEFINE
>
>DEFINE CLASS MyCommandButtonSub1 AS CommandButton
>  Name= 'MyCommandButtonSub1'
>ENDDEFINE
>
>DEFINE CLASS MyCommandGroupSub1 AS CommandGroup
>  Name= 'MyCommandGroupSub1'
>ENDDEFINE
>
>DEFINE CLASS MyContainerSub1 AS Container
>  Name= 'MyContainerSub1'
>ENDDEFINE
>
>DEFINE CLASS MyControlSub1 AS Control
>  Name= 'MyControlSub1'
>ENDDEFINE
>
>DEFINE CLASS MyCursorSub1 AS Cursor
>  Name= 'MyCursorSub1'
>ENDDEFINE
>
>DEFINE CLASS MyCustomSub1 AS Custom
>  Name= 'MyCustomSub1'
>ENDDEFINE
>
>DEFINE CLASS MyDataenvironmentSub1 AS Dataenvironment
>  Name= 'MyDataenvironmentSub1'
>ENDDEFINE
>
>DEFINE CLASS MyEditBoxSub1 AS EditBox
>  Name= 'MyEditBoxSub1'
>ENDDEFINE
>
>DEFINE CLASS MyFormSub1 AS Form
>  Name= 'MyFormSub1'
>ENDDEFINE
>
>DEFINE CLASS MyFormSetSub1 AS FormSet
>  Name= 'MyFormSetSub1'
>ENDDEFINE
>
>DEFINE CLASS MyFormSetSub2 AS FormSet && FormSet with Private Datasession
>  Name= 'MyFormSetSub2'
>  DataSession = 2
>ENDDEFINE
>
>DEFINE CLASS MyGridSub1 AS Grid
>  Name= 'MyGridSub1'
>ENDDEFINE
>
>DEFINE CLASS MyHeaderSub1 AS Header
>  Name= 'MyHeaderSub1'
>ENDDEFINE
>
>DEFINE CLASS MyImageSub1 AS Image
>  Name= 'MyImageSub1'
>ENDDEFINE
>
>DEFINE CLASS MyLabelSub1 AS Label
>  Name= 'MyLabelSub1'
>ENDDEFINE
>
>DEFINE CLASS MyLineSub1 AS Line
>  Name= 'MyLineSub1'
>ENDDEFINE
>
>DEFINE CLASS MyListBoxSub1 AS ListBox
>  Name= 'MyListBoxSub1'
>ENDDEFINE
>
>DEFINE CLASS MyOptionButtonSub1 AS OptionButton
>  Name= 'MyOptionButtonSub1'
>ENDDEFINE
>
>DEFINE CLASS MyOptionGroupSub1 AS OptionGroup
>  Name= 'MyOptionGroupSub1'
>ENDDEFINE
>
>DEFINE CLASS MyPageSub1 AS Page
>  Name= 'MyPageSub1'
>ENDDEFINE
>
>DEFINE CLASS MyPageFrameSub1 AS PageFrame
>  Name= 'MyPageFrameSub1'
>ENDDEFINE
>
>DEFINE CLASS MyRelationSub1 AS Relation
>  Name= 'MyRelationSub1'
>ENDDEFINE
>
>DEFINE CLASS MyRelationSub2 AS Relation
>&&Omit the name and it becomes much fatter
>&&Not in VFP 7/8!
>ENDDEFINE
>
>DEFINE CLASS MySeparatorSub1 AS Separator
>  Name= 'MySeparatorSub1'
>ENDDEFINE
>
>DEFINE CLASS MySessionSub1 AS Session
>  Name= 'MySessionSub1'
>ENDDEFINE
>
>DEFINE CLASS MyShapeSub1 AS Shape
>  Name= 'MyShapeSub1'
>ENDDEFINE
>
>DEFINE CLASS MySpinnerSub1 AS Spinner
>  Name= 'MySpinnerSub1'
>ENDDEFINE
>
>DEFINE CLASS MyTextBoxSub1 AS TextBox
>  Name= 'MyTextBoxSub1'
>ENDDEFINE
>
>DEFINE CLASS MyTimerSub1 AS Timer
>  Name= 'MyTimerSub1'
>ENDDEFINE
>
>DEFINE CLASS MyToolBarSub1 AS ToolBar
>  Name= 'MyToolBarSub1'
>ENDDEFINE
>
Thank you very much for illustrating the point.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform