Mercurial > hg > svcore
diff data/fileio/MatrixFile.cpp @ 411:52303ec15cd2
* Permit holding Shift while dragging an instant or other edited thing,
to override the initial drag resistance (for #1928943 sticky time
instants)
* better handling of updates during progressive decode load
* ready() signal from model (used by vect)
author | Chris Cannam |
---|---|
date | Mon, 19 May 2008 17:23:11 +0000 |
parents | 115f60df1e4d |
children | 5e4238d08caa |
line wrap: on
line diff
--- a/data/fileio/MatrixFile.cpp Fri May 16 13:27:07 2008 +0000 +++ b/data/fileio/MatrixFile.cpp Mon May 19 17:23:11 2008 +0000 @@ -272,7 +272,8 @@ m_defaultCacheWidth = w; } - static size_t maxCacheMB = 16; +//!!! static size_t maxCacheMB = 16; + static size_t maxCacheMB = 4; if (2 * m_defaultCacheWidth * h * m_cellSize > maxCacheMB * 1024 * 1024) { //!!! m_defaultCacheWidth = (maxCacheMB * 1024 * 1024) / (2 * h * m_cellSize); if (m_defaultCacheWidth < 16) m_defaultCacheWidth = 16; @@ -425,7 +426,8 @@ assert(m_mode == ReadWrite); #ifdef DEBUG_MATRIX_FILE_READ_SET - std::cerr << "MatrixFile::setColumnAt(" << x << ")" << std::endl; +// std::cerr << "MatrixFile::setColumnAt(" << x << ")" << std::endl; + std::cerr << "."; #endif ssize_t w = 0; @@ -517,6 +519,8 @@ std::cerr << "MatrixFile(" << this << ":" << m_fileName.toStdString() << ")::resume(): fd is " << m_fd << std::endl; } +static int alloc = 0; + void MatrixFile::primeCache(size_t x, bool goingLeft) { @@ -586,9 +590,14 @@ #endif if (m_cache.data) { - if (m_spareData) free(m_spareData); + if (m_spareData) { + std::cerr << this << ": Freeing spare data" << std::endl; + free(m_spareData); + } + std::cerr << this << ": Moving old cache data to spare" << std::endl; m_spareData = m_cache.data; } + std::cerr << this << ": Moving request data to cache" << std::endl; m_cache.data = request.data; m_readThread->done(m_requestToken); @@ -611,7 +620,11 @@ std::cerr << "cancelled " << m_requestToken << std::endl; #endif - if (m_spareData) free(m_spareData); + if (m_spareData) { + std::cerr << this << ": Freeing spare data" << std::endl; + free(m_spareData); + } + std::cerr << this << ": Moving request data to spare" << std::endl; m_spareData = request.data; m_readThread->done(m_requestToken); @@ -627,6 +640,9 @@ request.mutex = &m_fdMutex; request.start = m_headerSize + rx * m_height * m_cellSize; request.size = rw * m_height * m_cellSize; + + std::cerr << this << ": Moving spare data to request, and resizing to " << rw * m_height * m_cellSize << std::endl; + request.data = (char *)realloc(m_spareData, rw * m_height * m_cellSize); MUNLOCK(request.data, rw * m_height * m_cellSize); m_spareData = 0;