Boost logo

Boost Users :

From: scan man (scanmatter_at_[hidden])
Date: 2007-05-24 13:06:38


I modified the test program shipped in the boost::iostreams to decompress a
1.5 GB file which expand to 6GB. The program exits after writing 900KB of
data without throwing exceptions.

It is reproduced below, I was told in the irc channel that this was a bug in
alloc and will be probably fixed in 1.34.1.

-r

#include <fstream>
#include <iostream>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/bzip2.hpp>

using namespace std;
namespace bio = boost::iostreams;
int main ( int argc, char ** argv ) {

  if (argc < 2) {
    fprintf(stderr, "Usage: %s data_filename\n", argv[0]);
    exit(0);
  }

  ifstream file(argv[1], ios_base::in|ios_base::binary );

  if ( !file.good() ) {
    fprintf(stderr, "Unable to open file%s\n", argv[1]);
    exit(0);
  } else {
    try {
      bio::filtering_stream < bio::input > in;
      in.push( bio::bzip2_decompressor () );
      in.push( file );
      bio::copy ( in, cout );
    } catch ( const std::exception& e ) {
      std::cerr<<"\nCaught std::exception " << ": "<< e.what() << std::endl;
    }
  }
}



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