Mercurial > hg > svcore
changeset 575:8688430850d6
* either I'm going mad or the compiler is... valgrind and sizeof both
seem to think that reading or writing m_size is reading beyond the end
of the object, unless I add m_spare padding... why?
author | Chris Cannam |
---|---|
date | Mon, 16 Mar 2009 16:32:02 +0000 |
parents | 2d551c765d51 |
children | 2ba202c5be8d |
files | base/RingBuffer.h |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/base/RingBuffer.h Mon Mar 16 13:56:11 2009 +0000 +++ b/base/RingBuffer.h Mon Mar 16 16:32:02 2009 +0000 @@ -165,6 +165,7 @@ size_t m_writer; size_t *m_readers; size_t m_size; + size_t m_spare; static Scavenger<ScavengerArrayWrapper<T> > m_scavenger; @@ -187,9 +188,16 @@ #ifdef DEBUG_RINGBUFFER std::cerr << "RingBuffer<T," << N << ">[" << this << "]::RingBuffer(" << n << ")" << std::endl; #endif +/* + std::cerr << "note: sizeof(RingBuffer<T,N> = " << sizeof(RingBuffer<T,N>) << ")" << std::endl; - std::cerr << "note: sizeof(RingBuffer<T,N> = " << sizeof(RingBuffer<T,N>) << std::endl; - + std::cerr << "this = " << this << std::endl; + std::cerr << "&m_buffer = " << &m_buffer << std::endl; + std::cerr << "&m_mlocked = " << &m_mlocked << std::endl; + std::cerr << "&m_writer = " << &m_writer << std::endl; + std::cerr << "&m_readers = " << &m_readers << std::endl; + std::cerr << "&m_size = " << &m_size << std::endl; +*/ for (int i = 0; i < N; ++i) m_readers[i] = 0; m_scavenger.scavenge();