> Interestingly refcallback never called on quit (to get rid of locals); but I 
> guess you don;t need to, cause if you're blasting them out of existence as 
> they go out of scope, who cares what their ref count is.
>

refcallback is only called to add a reference (and in one other special case -- 
see below).  

Instead, the free routine that the plugin specifies in

BOOL (*RegisterSig)(BOOL b, LPSTR sig, LPSTR sig2, LPSTR szPlugName,

void (*callback)(LPSTR sz), LPSTR szGet, LPSTR szSet,LPSTR szDo,LPSTR szSetDo );

as the callback is called for freeing -- it should decrement the ref count and 
free when it reaches zero.

refcallback(...,0) is only used when a ref-counted object is created but never 
assigned.  For example, if vecs were ref-counted, then you could say the 
following without leaking memory:

file.writeall(vec.sort(vec.createfromlines(file.readall(...))))

to read and sort a file.  Right now, the created vec would not be freed.  But 
if vecs were ref counted, then refcallback(...,0) would be called by 
powerpro.exe when it cleaned up temporaries since the vec is never assigned.

Reply via email to