View Full Version : Memory usage of avisynth
mdjaved
21st September 2007, 05:52
Hi every1! I'm new to avisynth and I was just having a small doubt. Couldnt get much info outside so hopefully I can get some answers here. I use The KMPlayer and I was trying to play a Matroska file (about 1.2gb) i had created. I also checked the memory usage using Task Manager. It was around 26mb approx. Now i tried to using a simple avisynth script to play the file [DirectShowSource("g:\xmen2\x21.mkv", fps=25)]. I then checked the memory usage and it went upto 80mb and still increasing. All i want to know is how much memory does avisynth actually use. Just out of curiosity. Its a really powerful tool no doubt but I wanna know if my system would be able to handle more complex filters. Thanks in advance.
J
PS My systems specs, in case any1 wants to know,
P4 2.8 GHz (i think itz HT), 480 MB RAM, Win XP SP2
Dark Shikari
21st September 2007, 05:56
SetMemoryMax() is your friend.
I assume you have a .avsi script in the plugins folder that's setting it higher... either way you can override it in your script. SetMemoryMax(16) for 16 megabytes, for example.
TheRyuu
21st September 2007, 16:14
SetMemoryMax() is your friend.
I assume you have a .avsi script in the plugins folder that's setting it higher... either way you can override it in your script. SetMemoryMax(16) for 16 megabytes, for example.
Does setting it to a higher number like 768 or 1024 offer a lot of benefit if you have that kind of ram?
I have 2GB of ram, and I pretty much use setmemorymax(512) most of the time.
Should I go more? less?
Thanks.
Dark Shikari
21st September 2007, 18:03
Does setting it to a higher number like 768 or 1024 offer a lot of benefit if you have that kind of ram?
I have 2GB of ram, and I pretty much use setmemorymax(512) most of the time.
Should I go more? less?
Thanks.
IIRC, Extra memory is useless beyond a pretty low value unless there's a specific case in which it benefits.
Example: If you're running a script that requires access to previous decoded frames, they have to be kept in memory; if there isn't enough memory available, they have to be decoded again.
Of course the filters also need some memory, IIRC, but in my experience that doesn't seem to come out of the MemoryMax, as FFT3DFilter runs fine with SetMemoryMax(32) even though it uses hundreds of megs of memory.
Demi9OD
21st September 2007, 19:52
I'm pretty sure SetMemoryMax is not very strictly enforced in 2.5.7 but will be in 2.5.8.
Manao
21st September 2007, 20:47
I'm pretty sure SetMemoryMax is not very strictly enforced in 2.5.7 but will be in 2.5.8.No. Filters are responsible for their own memory allocation and don't care about SetMemoryMax.
SetMemoryMax is usefull, not for complex filters, but for complex scripts that heavily use temporal filters. If too low, it will result in a slow down. However, 64 MB should be enough most of the times.
Leak
21st September 2007, 22:14
No. Filters are responsible for their own memory allocation and don't care about SetMemoryMax.
Yeah, it mainly limits the amount of memory used for the caches inserted between filters - how much memory the filters themselves use is up to them...
np: Luke Vibert - Swet (Chicago, Detroit, Redruth)
mdjaved
23rd September 2007, 16:46
Hi! Thanx for the replies. My net was down so I couldnt reply earlier. I tried using this script now
SetMemoryMax(32)
DirectShowSource("g:\xmen2\x21.mkv", fps=25)
Still doesnt help. I checked the memory usage. Seems to be the same. Any other settings I'm missing here ?
IanB
24th September 2007, 00:06
SetMemoryMax() only controls the size of the cache's videobuffer pool. It only manages memory obtained thru env->NewVideoFrame().
Everything else is the responsibility of the individual filters. With such a simple script if the memory is growing then you need to look elsewhere.
Given you are using DirectShow it is likely some of the components are leaking or being extravagant with their memory usage.
Render your x21.mkv file directly in GraphEdit then play it. This is the interface DirectShowSOurce uses internally. Monitor the memory usage of GraphEdit. Test installing different mkv software. If you identify a problem report it to the appropriate author.
Also the new FFMpegSource might be a more viable alternative to DirectShowSource for *.mkv files
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.