------- Comment #7 from ksharenkov at ya dot ru  2006-08-02 03:47 -------
Hello.

Now I can say more about this problem. before code listing
I am sure that problem in template instantiation.
code if CBaseSeat::CBaseSeat() id used deeply in templates 
holder<T1> contains T1 which contains of vector<Derived from BaseSeat> which
contains vector<int>

there are facts:
1) The leak was gone just i removed line    
m_cardsSet.reserve( MAX_CARDS_ON_HAND );
it was need only for allocatio optimize

2) Windows version of this code not affected by this problem

In any case i will try to create self contained test code when i will have a
day for it. But it will be rather big i think.


There is the code:
//----------------------------------------------------------------------------------------
CMessage* CMessage::clone() const
{
    CMessage* result = new CMessage( m_descriptor, m_session, m_id );
    std::stringstream buffer;

    this->write( buffer );

    // read unnecessary type
    short type;
    shortSerializer.read( buffer, type );
    result->read( buffer );

    return result;
}

//----------------------------------------------------------------------------------------
CMessage* CMessageFactory::createInstance( CSession* sess, MessageType type )
{
    Descriptors::iterator pos = m_descriptors.find( type );
    if( pos==m_descriptors.end() )
    {
        throw std::logic_error("ERROR: Trying create message of unknown type"
);
    }

    CMessage* result = new CMessage( pos->second, sess, nextMessageId() );

    return result;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27530

Reply via email to