View Single Post
Old 30th June 2014, 10:25   #18  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by fvisagie View Post
It's well understood that such variables and arguments - not that there's much distinction in this regard - are not usable beyond the lifetime of the nested scope. But what about the memory occupied by them - when does that get released, specifically when called from runtime?
All values (of all types) in Avisynth are structures referenced via so-called 'smart' pointers, and are freed the moment there is no longer anything pointing at them. In general then, when a variable goes out of scope, its value will be freed, unless there is another reference to it somewhere (eg via 'last').

However, string values themselves just contain pointers to the actual characters which (for most strings, and certainly those created by script operations) are stored in the string heap. As StainlessS pointed out above, the contents of this heap are not freed until the script is unloaded, even though the string values pointing to them may have been deleted.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote