View Full Version : Memory leak?
waka
2nd October 2002, 10:16
I've long had a problem with what seems to be a memory leak caused by avisynth. When I use avisynth to open a huffyuv file in virtualdub and then preview or save it, all of my available memory gradually disappears. Closing virtualdub brings all my memory back. This occurs with any sort of avisynth script, even just a simple avisource. Without avisynth there is no problem. I've tried various versions of vdub and avisynth and it happens in all of them. For the record, I am running win2k and have 512megs of ram.
After some testing it appears related to frame size. Or rather the amount of data per frame, as mpeg4 and the like are no problem.
480x360 or greater huffyuv or uncompressed rgb - leaks.
360x270 or less - does not leak.
Big frames resized down to 320x240 in avisynth - leaks.
Small frames resized up to 640X480 in avisynth - does not leak.
A 640x480 blankclip created on the fly by avisynth does not leak, but that clip saved to huffyuv and then opened via avisynth leaks.
Anyone have any ideas or suggestions?
hakko504
2nd October 2002, 11:30
A few suggestions: Try SetMemoryMax(64) first in your script (needs v2.04 or newer). This should clear the cache every now and then. Open the .avi with DirectShowSource instead of AviSource. I usually don't recommend it but there are some differences in those two source commands and it might yield different results. Try using mod16 resolutions: 480x360 is NOT mod16 (but all the others are so that is not the source of your problem)
sh0dan
2nd October 2002, 11:51
Is it ONLY when opening a big huffyuv file, and not MPEG4/MJPEG/whatever?
waka
2nd October 2002, 13:55
SetMemoryMax didn't help on 5000 frame clips of huffyuv or mjpeg. Directshowsource gives an unrecognized exception when trying to open in vdub. I have also tried specifing avifilesource and opendmlsource, neither helps. Typically I do use mod16, the 480x360 was just for experimentation purposes.
A 5000 frame 640x480 test clip in xvid(611MB in size) is fine. The same clip in mjpeg(761MB) or huffyuv(1.26GB) is not ok. With a lower setting in mjpeg(244MB) it works fine. The clip resized to 480x360 and in huffyuv(687MB) is not ok. However, a blankclip at 480x360 in huffyuv(360MB) does work fine. Seems like the problem is codec independant, instead anything above ~3000KB/s causes problems. Dunno if this makes any sense to those who are fimilar with avisynth code.
Thanks
Edit: KB/frame is probably the pertinent number, as the big mjpeg still has problems at 10fps, in which case the clips were either 23.976 or 24 fps, resulting in ~125KB/frame.
trbarry
2nd October 2002, 15:33
I'm not sure about codec independent. I regularly process 1920x1080 input clips with mpeg2dec2.dll and don't see this problem. But maybe buffers are managed differently there.
- Tom
waka
3rd October 2002, 01:46
I haven’t seen this described elsewhere so I’m guessing its some weird confluence of factors on my system. Just for fun I made a 720x480 quantizer 1 xvid clip, which caused problems. At this point I imagine I could get any codec to cause problems if it is sufficiently large. Typically I don't work with mpeg2 but I'll take a look at mpeg2dec.dll and see if I can get the same thing to happen.
At any rate it looks like I will use picvideo mjpeg with a setting of 18 or 19 whenever I need to manipulate large video with avisynth, 20 is no go. I would prefer to use huffyuv all the time but mjpeg isn’t the end of the world. I’d still be interested in any explanations or fixes anyone can think of.
Thanks
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.