If anyone is interested in testing, there is a ref counted version of vec 
plugin here:


http://powerpro.webeddie.com/download/vec.dll
http://powerpro.webeddie.com/download/powerpro.exe

You must also use the updated exe (4.9m10)

Testing just involves using the updated vec.dll with your existing scripts and 
letting me know if any issues occur

Advantages of reference counting:

- no need for localcopy  (ignored silently if you use it)
- no need for vec.destroy (ignored silently if you use it)
- unlimited number of vecs

This works without leaking memory:
b = vec.createfromwords(somestring).sort.makewords(" ")


This also works without leaking memory
for each vw in vec.createfromwords(star_sep_string,"*")

This works too (current version would lose v1 and v2 in function call as they 
are local:

function dotest4()
local str=dotest4b()
//str.v1[1]==11
//str.v2[1]==22

function dotest4b
local v1=vec.create(5)
local v2=vec.create(6)
v1[1]=11
v2[1]=22
local s=class.makestruct("v1 v2")
s.v1=v1
s.v2=v2
quit(s)



------------------
some debugging functions have been added to vec plugin

vec.__nalloc__  //number of allocated vectors
v1.__refs__ // number of references to vector handle in v1

You can use these functions to verify memory is getting released, if you want.





Reply via email to