Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
19th December 2016, 12:23 | #1 | Link |
Registered User
Join Date: Jan 2008
Posts: 42
|
Avisynth Memory allocation
Hi all,
can someone share me a few insights on how Avisynth (not the plus version) handles memory allocation. For instance: If I write a .avs script hat opens two 1080p video files (AVC) and each one gets its own variable, I suspect avisynth will allocate memory for both making it accessible via the variables. Also I assume that this references will be available due script has finished execution. Or is there kind of an "deconstructor" to explicitly free memory ? Now, what if I re-assign an new Video file to the same variable ? Will the "old" allocation be dropped and a new be made ? I've read that Plugins (such as external decoders: ffmpeg-source, lsmash ect) do their own memory management. So in the end it seems quite impossible to guess how much memory your script will allocate until you open it and check with a task manager ... and even that seems to be fairly correct as tailing functions, scripts or plugins will add to this number making it quite unpredictable (think of de-interlacers). Or do I miss anything here ? Can you give me an insight on how avs memory management works |
19th December 2016, 19:16 | #4 | Link | |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,496
|
Quote:
Code:
a=avisource("one.avi") b=avisource("two.avi") c=a+b b=avisource("three.avi") return b+c |
|
19th December 2016, 21:13 | #6 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
Code:
a=avisource("one.avi") b=avisource("two.avi") b=0 # would for sure call destructor on clip b return(a) EDIT: Unless eg Code:
a=avisource("one.avi") b=avisource("two.avi") c=b b=0 # Instance c copy of b may well still persist and so "two.avi may remain open. return(a) during frame serving, but local variables at local function level would cease to be (unless called via some runtime environment filter eg Scriptclip). I guess the definitive answer is 'it depends'. Here post on order that things occur during compile stage, might be of interest:- http://forum.doom9.org/showthread.ph...54#post1594454 EDIT: You could always find out for yourself (check out RT_Stats) Code:
#a=avisource("one.avi") #b=avisource("two.avi") a=ColorBars.KillAudio b=ColorBars.KillAudio SSS=""" n=current_frame Ex=RT_VarExist("b") RT_DebugF("%d] b %s Exist",n,Ex?"does":"does not",name="TEST: ") RT_Subtitle("%d] b %s Exist",n,Ex?"does":"does not") """ return a.ScriptClip(SSS) Code:
00000005 21:11:11.515 TEST: 0] b does Exist 00000006 21:11:11.562 TEST: 1] b does Exist 00000007 21:11:11.593 TEST: 2] b does Exist 00000008 21:11:11.625 TEST: 3] b does Exist 00000009 21:11:11.656 TEST: 4] b does Exist 00000010 21:11:11.687 TEST: 5] b does Exist
__________________
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; 19th December 2016 at 22:25. |
|
19th December 2016, 22:21 | #7 | Link | ||
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
Quote:
It took 2 minutes to test that with AVSMeter as suggested above.
__________________
Groucho's Avisynth Stuff Last edited by Groucho2004; 19th December 2016 at 22:27. |
||
|
|