Changeset 17677 for trunk/Mars


Ignore:
Timestamp:
04/18/14 22:00:37 (11 years ago)
Author:
tbretz
Message:
Fixed the last fix... using a variable type which allows hundreds of terabytes to be allocated is for sure no option. Actually, restricting the amount of memory which can be allocated is a feature not a problem. The correct way to fix the problem is to properly cast the variable before it is converted from kB to Byte.
File:
1 edited

Legend:

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

    r17667 r17677  
    8181        /// static setter for the default number of threads to use. -1 means all available physical cores
    8282        static uint32_t DefaultNumThreads(const uint32_t &_n=-2) { static uint32_t n=0; if (int32_t(_n)<-1) n=_n; return n; }
    83         static uint64_t DefaultMaxMemory(const uint64_t &_n=0) { static uint64_t n=1000000; if (_n>0) n=_n; return n; }
     83        static uint32_t DefaultMaxMemory(const uint32_t &_n=0) { static uint32_t n=1000000; if (_n>0) n=_n; return n; }
    8484        static uint32_t DefaultMaxNumTiles(const uint32_t &_n=0) { static uint32_t n=1000; if (_n>0) n=_n; return n; }
    8585        static uint32_t DefaultNumRowsPerTile(const uint32_t &_n=0) { static uint32_t n=100; if (_n>0) n=_n; return n; }
     
    9191        zofits(uint32_t numTiles    = DefaultMaxNumTiles(),
    9292               uint32_t rowPerTile  = DefaultNumRowsPerTile(),
    93                uint64_t maxUsableMem= DefaultMaxMemory()) : ofits(),
    94             fMemPool(0, maxUsableMem*1000),
     93               uint32_t maxUsableMem= DefaultMaxMemory()) : ofits(),
     94            fMemPool(0, size_t(maxUsableMem)*1000),
    9595            fWriteToDiskQueue(std::bind(&zofits::WriteBufferToDisk, this, std::placeholders::_1), false)
    9696        {
     
    106106               uint32_t numTiles    = DefaultMaxNumTiles(),
    107107               uint32_t rowPerTile  = DefaultNumRowsPerTile(),
    108                uint64_t maxUsableMem= DefaultMaxMemory()) : ofits(fname),
     108               uint32_t maxUsableMem= DefaultMaxMemory()) : ofits(fname),
    109109                   fMemPool(0, maxUsableMem*1000),
    110110                   fWriteToDiskQueue(std::bind(&zofits::WriteBufferToDisk, this, std::placeholders::_1), false)
     
    155155                //start the compression queues
    156156                for (auto it=fCompressionQueues.begin(); it!= fCompressionQueues.end(); it++)
    157                 {
    158157                    it->start();
    159                 }
     158
    160159                //start the disk writer
    161160                fWriteToDiskQueue.start();
     
    536535
    537536        /// Overload of the ofits method. Just calls the zofits specific one with default, uncompressed options for this column
    538         bool AddColumn(uint32_t cnt,
    539                        char typechar,
    540                        const std::string& name,
    541                        const std::string& unit,
    542                        const std::string& comment="",
    543                        bool addHeaderKeys=true)
     537        bool AddColumn(uint32_t cnt, char typechar, const std::string& name, const std::string& unit,
     538                       const std::string& comment="", bool addHeaderKeys=true)
    544539        {
    545540            return AddColumn(FITS::kFactRaw, cnt, typechar, name, unit, comment, addHeaderKeys);
Note: See TracChangeset for help on using the changeset viewer.