diff src/Matcher.cpp @ 209:d46be43c0738 memory

Grow matrix less enthusiastically, call shrink_to_fit() on vectors
author Chris Cannam
date Fri, 27 Feb 2015 13:57:07 +0000
parents 9a8fc47d4f93
children 6373d14deace
line wrap: on
line diff
--- a/src/Matcher.cpp	Fri Feb 27 12:59:37 2015 +0000
+++ b/src/Matcher.cpp	Fri Feb 27 13:57:07 2015 +0000
@@ -300,7 +300,7 @@
     int frameIndex = m_frameCount % m_blockSize;
 
     if (m_frameCount >= m_distXSize) {
-        m_distXSize *= 2;
+        m_distXSize *= 1.2;
         size();
     }
     
@@ -309,8 +309,11 @@
         int oldidx = m_frameCount - m_blockSize;
         int len = m_last[oldidx] - m_first[oldidx];
         m_distance[oldidx].resize(len);
+        m_distance[oldidx].shrink_to_fit();
         m_bestPathCost[oldidx].resize(len);
+        m_bestPathCost[oldidx].shrink_to_fit();
         m_advance[oldidx].resize(len);
+        m_advance[oldidx].shrink_to_fit();
     }
 
     int stop = m_otherMatcher->m_frameCount;