First, let me say, I am using DBPro ver. 7.4 and the most recent update of Enhanced Animations (19th Jan 2010). So this may be an issue with me not having DBPro ver. 7.5, but I do not see how.
There is a memory leak for me when deleting and recreating OAC's, basically what happens is when an OAC is deleted, the memory that was assigned to it is not being cleared, thus resulting in an increase in memory upon every consecutive recreation of an OAC. I am using Task Manager to monitor this.
Here is the code I am using to test this.
set display mode screen width(), screen height(),16,1
sync on
sync rate 60
autocam off
mainObj = freeobject()
load object "main1.dbo",mainObj
position object mainObj,-2,0,0
mainOac = EnAn_oacCreate( mainObj )
cloneObj = freeobject()
clone object cloneObj,mainObj
position object cloneObj,2,0,0
cloneOac = enan_oaccreateclone(cloneobj,mainoac)
`cloneOac = enan_oaccreate(cloneobj)
position camera 0,4,-9
recloneCount = 0
do
control camera using arrowkeys 0,.1,3
`Press space to continually delete and recreate the object and OAC
`If you rem out the enan_oacDelete and enan_oacCreate commands, there is no memory leak
if spacekey() = 1
inc recloneCount
enan_oacdelete cloneOac
`delete object cloneObj
`clone object cloneObj,mainObj
position object cloneObj,2,0,0
cloneOac = enan_oaccreateclone(cloneobj,mainoac)
`cloneOac = enan_oaccreate(cloneobj)
endif
`Not needed for this test
`enan_oacupdate mainoac,16
`enan_oacupdate cloneoac,16
`display text
text 1,1,"FPS: "+str$(screen fps())
text 1,15,"Hold Space to have the program repeatedly delete and re-clone the object and oac"
text 1,30,"If you look at task manager, you will see memory usage for this program increase"
text 1,45,"Clone OAC ID: " + str$(cloneOAC)
text 1,60,"Times recloned: " + str$(recloneCount)
center text object screen x(mainObj),object screen y(mainObj),"Original Object"
center text object screen x(cloneObj),object screen y(cloneObj),"Cloned Object"
sync
loop
function freeObject()
i = 1
while object exist(i) = 1
inc i
endwhile
endfunction i
I have contacted Wolf on the matter, but he is getting results that are not consistent with mine, so I am hopeful this thread can reach a more conclusive answer as to where the memory leak is occurring.
I have attached the project that I am using to test this. (You will need Enhanced Animations to compile.)
I would grateful if someone else could test and confirm this.
"What I have shown you is reality. What you remember, that is the illusion."