Changeset 1895


Ignore:
Timestamp:
Oct 11, 2005, 5:00:44 PM (17 years ago)
Author:
ole
Message:

Caught potential memory problem

Location:
inundation/caching
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inundation/caching/DOC.txt

    r130 r1895  
    9595    disables compression. (Default: compression=1). If the requested compressed
    9696    or uncompressed file is not there, it'll try the other version.
     97   
     98    Sometimes compression==1 can cause a MemoryException.
     99    In that case try the uncompressed version.
    97100
    98101  Forced evaluation:
  • inundation/caching/caching.py

    r1831 r1895  
    12541254     
    12551255
    1256     Ts  = pickler.dumps(T,bin)
    1257     TsC = zlib.compress(Ts,comp_level)
    1258     file.write(TsC)
     1256    try:
     1257      Ts  = pickler.dumps(T,bin)
     1258    except MemoryError:
     1259      msg = '****WARNING (caching.py): Could not pickle data for compression.'
     1260      msg += ' Try using compression = False'
     1261      raise MemoryError, msg
     1262    else: 
     1263      #Compressed pickling     
     1264      TsC = zlib.compress(Ts,comp_level)
     1265      file.write(TsC)
    12591266  else:
    1260     pickler.dump(T,file,bin)
     1267      #Uncompressed pickling
     1268      pickler.dump(T,file,bin)
     1269
     1270     
    12611271
    12621272# -----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.