ok..this may well be common knowledge, but its interesting
anyway. It would seem that released objects are cached,
so that subsequent 'new' allocations will infact simply return
an object from the cache - how well this works for complex
objects i dont know..but this simple sample demonstrates
the bmax memory management in action..well sortof anwyay.
type v3df
field x:float, y:float, z:float
endtype
Local vecs1:v3df[150000]
For Local z:Int=0 To 1
Print "~n~n~n PASS "+z
Local t:Int=MilliSecs()
For Local n:Int=0 To 150000-1
vecs1[n]=New v3df
Next
For n:Int=0 To 150000-1
vecs1[n]=Null
Next
t=MilliSecs()-t
Print "~n time taken = "+t
Next
It may well be that if the objects in the pool are inactive for
a given time, they are released - infact i would imagine this
is how how it works...but regardless, this does atleast
highlight the fact that you may not need to implement
a custom system..
forcing gcCollect() - will trash this, the cache will be flushed. keep this in mind..
a little more info from BRL on how the memory manager
works would be quite helpful...so if your about mr sibly or
mr armstrong..perhaps you could enlighten us :p ;)
anyway. It would seem that released objects are cached,
so that subsequent 'new' allocations will infact simply return
an object from the cache - how well this works for complex
objects i dont know..but this simple sample demonstrates
the bmax memory management in action..well sortof anwyay.
type v3df
field x:float, y:float, z:float
endtype
Local vecs1:v3df[150000]
For Local z:Int=0 To 1
Print "~n~n~n PASS "+z
Local t:Int=MilliSecs()
For Local n:Int=0 To 150000-1
vecs1[n]=New v3df
Next
For n:Int=0 To 150000-1
vecs1[n]=Null
Next
t=MilliSecs()-t
Print "~n time taken = "+t
Next
It may well be that if the objects in the pool are inactive for
a given time, they are released - infact i would imagine this
is how how it works...but regardless, this does atleast
highlight the fact that you may not need to implement
a custom system..
forcing gcCollect() - will trash this, the cache will be flushed. keep this in mind..
a little more info from BRL on how the memory manager
works would be quite helpful...so if your about mr sibly or
mr armstrong..perhaps you could enlighten us :p ;)