View Single Post
Old 30th June 2014, 11:55   #19  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Even if desired by Avisynth developers, I dont think strings (the actual string characters) could be freed, as it is
in docs that plugin devs can return a string to Avisynth using env->SaveString to make a copy of a plugin's
string (mem allocation is quite separate between plugins and Avisynth, string memory is copied from plugin memory
heap to Avisynth memory heap, giving Avisynth total ownership and duty to later free mem), and if they
(plug devs) keep a pointer to that memory block they can re-use it so long as they do not overwrite the bounds
of that memory block which is owned by Avisynth.
One thing I have found though, (and I dont think it was mentioned in docs anywhere), if setting a local or global variable
from within a plugin, it is unnecessary to env->SaveString() the name of the variable, if it already exists, Avisynth will
not re-create another variable (with identical name) in the string table, the old one will be re-used. (kinda makes sense really).
The only way that some script local strings could be freed would be if future versions of avisynth kept separate track of strings
created locally by the parser, and were in no way returned by - or created by a plugin.
[Although perhaps a new env-SaveString2() or whatever could be added which plugin writers could not later access contents of.]

EDIT: I'm not actually aware of any plugin that later uses string memory now belonging to Avisynth, although I would not
be surprised if AVSLib did so.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 30th June 2014 at 12:10.
StainlessS is offline   Reply With Quote