Changeset 15266


Ignore:
Timestamp:
04/06/13 12:19:04 (12 years ago)
Author:
tbretz
Message:
Allocation the buffer on the stack can give problems because it is pretty big. Allocate it on the heap instead.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mcore/izstream.h

    r11806 r15266  
    2020{
    2121private:
    22     static const int fgBufferSize = 3276804; // maximum size of a fact event + 4
     22    static const int fgBufferSize = 2048*1024*2;
    2323
    24     gzFile fFile;                 // file handle for compressed file
    25     char   fBuffer[fgBufferSize]; // data buffer
     24    gzFile fFile;   // file handle for compressed file
     25    char  *fBuffer; // data buffer
    2626
    2727    int underflow()
     
    5656    izstream() : std::istream(this), fFile(0)
    5757    {
     58        fBuffer = new char[fgBufferSize];
    5859        setg(fBuffer+4, fBuffer+4, fBuffer+4);
    5960    }
    6061    izstream(const char *name) : std::istream(this), fFile(0)
    6162    {
     63        fBuffer = new char[fgBufferSize];
    6264        setg(fBuffer+4, fBuffer+4, fBuffer+4);
    6365        open(name);
    6466    }
    65     ~izstream() { izstream::close(); }
     67    ~izstream() { izstream::close(); delete [] fBuffer; }
    6668
    6769    int is_open() { return fFile!=0; }
Note: See TracChangeset for help on using the changeset viewer.