webengine/osswebengine/MemoryManager/Src/fast_malloc.cpp
branchRCL_3
changeset 49 919f36ff910f
parent 48 79859ed3eea9
equal deleted inserted replaced
48:79859ed3eea9 49:919f36ff910f
   446 */
   446 */
   447 #include <e32base.h>
   447 #include <e32base.h>
   448 #include <e32hal.h>
   448 #include <e32hal.h>
   449 #include <hal.h>
   449 #include <hal.h>
   450 
   450 
   451 #include "MemoryManager.h"
   451 #include <MemoryManager.h>
   452 
   452 
   453 //#define OOM_LOGGING
   453 //#define OOM_LOGGING
   454 #include "MemoryLogger.h"
   454 #include "MemoryLogger.h"
   455 
   455 
   456 /*
   456 /*
  3675           insert_chunk(m, r, rsize);
  3675           insert_chunk(m, r, rsize);
  3676         }
  3676         }
  3677         return chunk2mem(v);
  3677         return chunk2mem(v);
  3678       }
  3678       }
  3679     }
  3679     }
  3680     CORRUPTION_ERROR_ACTION(m);
  3680 //    CORRUPTION_ERROR_ACTION(m);
  3681   }
  3681   }
  3682   return 0;
  3682   return 0;
  3683 }
  3683 }
  3684 
  3684 
  3685 /* allocate a small request from the best fitting chunk in a treebin */
  3685 /* allocate a small request from the best fitting chunk in a treebin */
  3714         replace_dv(m, r, rsize);
  3714         replace_dv(m, r, rsize);
  3715       }
  3715       }
  3716       return chunk2mem(v);
  3716       return chunk2mem(v);
  3717     }
  3717     }
  3718   }
  3718   }
  3719 
  3719   //CORRUPTION_ERROR_ACTION(m);
  3720   CORRUPTION_ERROR_ACTION(m);
  3720   //return 0;
  3721   return 0;
       
  3722 }
  3721 }
  3723 
  3722 
  3724 /* --------------------------- realloc support --------------------------- */
  3723 /* --------------------------- realloc support --------------------------- */
  3725 
  3724 
  3726 static void* internal_realloc(mstate m, void* oldmem, size_t bytes) {
  3725 static void* internal_realloc(mstate m, void* oldmem, size_t bytes) {
  5379 // This is not a crash-proof solution, because it
  5378 // This is not a crash-proof solution, because it
  5380 // is difficult to dictate the deleteing order of
  5379 // is difficult to dictate the deleteing order of
  5381 // global data and if closing util is not the last
  5380 // global data and if closing util is not the last
  5382 // one to be deleted, it will crash.  Luckly enough
  5381 // one to be deleted, it will crash.  Luckly enough
  5383 // , it seems to be working fine and no crash so far.
  5382 // , it seems to be working fine and no crash so far.
       
  5383 /*
  5384 struct ChunkClosingUtil
  5384 struct ChunkClosingUtil
  5385 {
  5385 {
  5386     ~ChunkClosingUtil()     { rchunk.Close(); }
  5386     ~ChunkClosingUtil()     { rchunk.Close(); }
  5387 };
  5387 };
  5388 
       
  5389 static ChunkClosingUtil __gx_closing;
  5388 static ChunkClosingUtil __gx_closing;
  5390 
  5389 */
  5391 /* -----------------------------------------------------------------------
  5390 /* -----------------------------------------------------------------------
  5392 History:
  5391 History:
  5393     C2.8.2 Sun Jun 12 16:01:10 2005  Doug Lea  (dl at gee)
  5392     C2.8.2 Sun Jun 12 16:01:10 2005  Doug Lea  (dl at gee)
  5394       * Fix memalign brace error.
  5393       * Fix memalign brace error.
  5395 
  5394