Boost logo

Boost :

Subject: [boost] [serialization] Memoryleak in void_caster::recursive_register
From: Runar Undheim (R.Undheim_at_[hidden])
Date: 2009-06-30 02:35:51

// implementation of void caster base class
void_caster::recursive_register(bool includes_virtual_base) const {
    void_cast_detail::set_type & s
        = void_cast_detail::void_caster_registry::get_mutable_instance();


    // generate all implied void_casts.

    void_cast_detail::set_type::const_iterator it;
    for(it = s.begin(); it != s.end(); ++it){
        if(m_derived == (*it)->m_base)
            new void_caster_shortcut(
                m_difference + (*it)->m_difference,
        if((*it)->m_derived == m_base)
            new void_caster_shortcut(
                m_difference + (*it)->m_difference,

The new void_caster_shortcut in void_caster::recursive_register give
memory leak. The leak is only at startup of program, so it doesn't eat
any memory while the program is running. But it makes it difficult to
find other memory leaks when the program contain several leaks you don't
care about.

- Runar

Boost list run by bdawes at, gregod at, cpdaniel at, john at