Hi All,
I'm new at this forum.
I encounter problem with circular_buffer.
Let me explain it on simple example (code is from circular_buffer.h):
I have a circular_buffer with few elements .
After read one of them element is destroyed:
template < typename T > T circular_buffer<T>::read() { T t = read_data(); buf_clear( m_buf, m_ri ); increment_read_pos(); return t; }
template < typename T >
inline void
circular_buffer<T>::buf_clear( void* buf, int n )
{ (static_cast<T*>(buf) + n)->~T(); }
} // namespace tlm
... but
In dectructor all elements are destroyed ... again
template < typename T > circular_buffer<T>::~circular_buffer() { for( int i=0; i < used(); i++ ) { buf_clear( m_buf, i ); //!!!! } buf_free( m_buf ); }
This case GPF's randomly.
I notice that when I change desctructor code
to
for( int i=m_ri; i < used() % m_size; i++ ) {
problem disappears
I'm using SystemC 2.3.0 Is this a bug in TLM sources or I'm doing something wrong ?
Radek