== Sequencer ==
authorPeter Schlaile <peter@schlaile.de>
Sun, 25 May 2008 16:07:32 +0000 (16:07 +0000)
committerPeter Schlaile <peter@schlaile.de>
Sun, 25 May 2008 16:07:32 +0000 (16:07 +0000)
Fixes
[#12106] Memory leak in sequencer (>10MB/frame)

in parts: inner contents of meta strips are freed up after calculation
making more room for the cache.

Actually have to think of a mechanism, that remembers, which output
frames are asked for and caches only those.

source/blender/src/sequence.c

index 1aca097e3731684c1ccdabc54aa5b6e632b6094a..bf519dd6e9cceb6824db6eacfe49897e76c5c358 100644 (file)
@@ -1632,6 +1632,36 @@ static void copy_to_ibuf_still(Sequence * seq, TStripElem * se)
        }
 }
 
+static void free_metastrip_imbufs(ListBase *seqbasep, int cfra, int chanshown)
+{
+       Sequence* seq_arr[MAXSEQ+1];
+       int i;
+       TStripElem* se = 0;
+
+       evaluate_seq_frame_gen(seq_arr, seqbasep, cfra);
+
+       for (i = 0; i < MAXSEQ; i++) {
+               if (!video_seq_is_rendered(seq_arr[i])) {
+                       continue;
+               }
+               se = give_tstripelem(seq_arr[i], cfra);
+               if (se) {
+                       if (se->ibuf) {
+                               IMB_freeImBuf(se->ibuf);
+
+                               se->ibuf= 0;
+                               se->ok= STRIPELEM_OK;
+                       }
+
+                       if (se->ibuf_comp) {
+                               IMB_freeImBuf(se->ibuf_comp);
+
+                               se->ibuf_comp = 0;
+                       }
+               }
+       }
+       
+}
 
 static TStripElem* do_build_seq_array_recursively(
        ListBase *seqbasep, int cfra, int chanshown);
@@ -1682,6 +1712,10 @@ static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra,
                                use_limiter = TRUE;
                        }
                }
+               if (meta_se) {
+                       free_metastrip_imbufs(
+                               &seq->seqbase, seq->start + se->nr, 0);
+               }
 
                if (use_limiter) {
                        input_preprocess(seq, se, cfra);