View Single Post
Old 31st May 2011, 11:07   #9  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by Mini-Me View Post
Does the string table accumulate entries every frame without ever being cleared? If so, is there a reason this is necessary, or could it be changed someday to recycle the memory?
Yes, the string table does accumulate entries for each frame rendered by a run-time filter.
I can think of a number of ways this could be improved/fixed, including changes to ScriptClip itself, but normally there is a simple workaround - use functions to cut down the size of the run-time script. Taking this approach to its limit, you can even replace the entire run-time script by a function call. Instead of writing
Code:
ScriptClip("""
  ... # very long script
""")
do this
Code:
function f(clip c, int current_frame) {
  c
  ... # code from run-time script
}
...
ScriptClip("f(current_frame)")
See here for an example which fixed a previously mysterious memory leak in SRestore.
(BTW The current_frame parameter is not needed if using GRunT, since it makes current_frame global).

In your case, the recursive use of ScriptClip adds a further complication, but I think you could restructure your code to call ScriptClip once and do the recursion inside it. In fact, you said in post #4 that you were able to do this with your earlier code.
__________________
GScript and GRunT - complex Avisynth scripting made easier

Last edited by Gavino; 31st May 2011 at 11:09.
Gavino is offline   Reply With Quote