Boost logo

Boost Users :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2005-08-12 13:48:05


Robert,

>> The following code leads to numerous leaks when lIn's contents are
>> not an xml_archive. Any thoughts on the cause?
>>
>> try
>> {
>> std::ifstream lIn( lpszPathName );
>>
>> if( lIn.good() )
>> {
>> boost::archive::xml_iarchive ia( lIn );
>> }
>> }
>> catch( boost::archive::xml_archive_exception& aExc )
>> {
>> std::string lErr = aExc.what();
>> }
>
> Hmm - this would surprise me. It looks to me that maybe I'm missing
> something about clean up from exceptions. baybe the std::ifstream lIn(
> lpszPathName ); should be moved outside the try block. I wouldn't think
> that should be necessary but now that I look at this it might be. What
> happens when you do this? Any C++ expert want to opine on this?

>> std::ifstream lIn( lpszPathName );
>>
>> try
>> {
>> if( lIn.good() )
>> {
>> boost::archive::xml_iarchive ia( lIn );
>> }
>> }
>> catch( boost::archive::xml_archive_exception& aExc )
>> {
>> std::string lErr = aExc.what();
>> }

results in the same leaks. By the way this is with VC7.1.

Jeff Flinn


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net