>DECLARE Sleep IN WIN32API integer >clear >lnLen = 1000 >el=SET("Eventlist") > >SET EVENTLIST TO init,Destroy >SET EVENTTRACKING TO SYS(2023)+'\track.log' >SET EVENTTRACKING ON > >lnStart=Seconds() >loCollection = Createobject("collection") >FOR k=1 TO lnLen > loCollection.Add(CREATEOBJECT("myException", 15), 'C1_'+TRANSFORM(m.k)) >NEXT >lnStart=Seconds() >loCollection.Remove(-1) >? 'Remove: ', Seconds() - lnStart >release loCollection > >loCollection = Createobject("collection") >FOR k=1 TO lnLen > loCollection.Add(CREATEOBJECT("myException", 15), 'C2_'+TRANSFORM(m.k)) >NEXT >lnStart=Seconds() >loCollection = Createobject("collection") >? 'Create: ', Seconds() - lnStart >release loCollection > >SET EVENTTRACKING OFF >SET EVENTTRACKING TO >SET EVENTLIST TO &el > >MODIFY FILE SYS(2023)+'\track.log' >ERASE SYS(2023)+'\track.log' > >DEFINE CLASS myException as Exception > PROTECTED nSleep > PROCEDURE init(tnSleep) > this.nSleep = IIF(VARTYPE(tnSleep)='N' and tnSleep > 0, tnSleep, 1) > ENDPROC > > PROCEDURE destroy > sleep(this.nSleep) > ENDPROC >ENDDEFINE >>
clear lnLen = 20000 lnItems = 5 && PRIVATE loCollection loCollection = null LOCAL lnFill1 ,lnRemove1,lnFill2 ,lnRemove2 ? "REMOVE" , testRemove() * heap monitor can work waittime() * try with release ? "RELEASE" , testRelease() PROCEDURE waittime * heap monitor can work lnStart=datetime()+2 DO WHILE DATETIME()<lnStart DOEVENTS FORCE ENDDO PROCEDURE testRemove FOR JK=1 TO 10000000 NEXT lnStart=Seconds() loCollection = Createobject("collection") FOR k=1 TO lnLen FOR j=1 TO lnItems =loCollection.Add(.F.) NEXT loCollection.REMOVE(-1) NEXT loCollection = NULL return Seconds() - lnStart PROCEDURE testRelease FOR JK=1 TO 1000000 NEXT lnStart=Seconds() FOR k=1 TO lnLen loCollection = Createobject("collection") FOR j=1 TO lnItems =loCollection.Add(.F.) NEXT loCollection = NULL NEXT return Seconds() - lnStart2. More important: