Boost logo

Boost :

Subject: Re: [boost] [serialization] Memoryleak invoid_caster::recursive_register
From: Runar Undheim (R.Undheim_at_[hidden])
Date: 2009-07-01 03:50:51


Thanks! I only trusted the memory leak report from the program :(
The memory detection is done when the destructor on a static class i
called, but it is not possible to decide which destructor is called
first. So I wonder if it is any function I could call to manually free
the memory. Then I could call this function in debug build before my
code check for memory leaks.

- Runar

Robert Ramey wrote:
> This create objects which register themselves in a global table. The table
> and objects persist until the execution module ends. Some methods of
> checking for memory leaks might check before the table
> and it's members are destroyed so it might look like they are leaks - but
> they're not. This can be seen
> by setting a debugger break point on the destructor of voice_cast_shortcut.
>
> Robert Ramey
>
> Runar Undheim wrote:
>
>> // implementation of void caster base class
>> BOOST_SERIALIZATION_DECL(void)
>> void_caster::recursive_register(bool includes_virtual_base) const {
>> void_cast_detail::set_type & s
>> =
>> void_cast_detail::void_caster_registry::get_mutable_instance();
>> s.insert(this);
>>
>> // 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(
>> (*it)->m_derived,
>> m_base,
>> m_difference + (*it)->m_difference,
>> includes_virtual_base
>> );
>> if((*it)->m_derived == m_base)
>> new void_caster_shortcut(
>> m_derived,
>> (*it)->m_base,
>> m_difference + (*it)->m_difference,
>> includes_virtual_base
>> );
>> }
>> }
>>
>> 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
>> _______________________________________________
>> Unsubscribe & other changes:
>> http://lists.boost.org/mailman/listinfo.cgi/boost
>>
>
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk