Ignore:
Timestamp:
Nov 16, 2001, 3:52:56 PM (24 years ago)
Author:
phaller
Message:

slightly more tuning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/os2heap.cpp

    r7358 r7360  
    1 /* $Id: os2heap.cpp,v 1.30 2001-11-16 12:57:00 phaller Exp $ */
     1/* $Id: os2heap.cpp,v 1.31 2001-11-16 14:52:55 phaller Exp $ */
    22
    33/*
     
    4040#endif
    4141
    42 VMutex heaplistmutex;   //protects linked lists of heaps
    43 
    4442void * _LNK_CONV getmoreHeapMem(Heap_t pHeap, size_t *size, int *clean);
    4543void   _LNK_CONV releaseHeapMem(Heap_t pHeap, void *block, size_t size);
    4644
     45VMutex heaplistmutex;   //protects linked lists of heaps
     46
    4747
    4848//******************************************************************************
     
    6060  OS2Heap *curheap = OS2Heap::heap;
    6161 
     62#ifdef DEBUG
    6263  totalAlloc   = 0;
     64#endif
    6365  fInitialized = 0;
    6466  nrHeaps      = 0;
     
    158160      memset(lpMem, 0, dwBytes+HEAP_OVERHEAD);
    159161  }
     162 
     163#ifdef DEBUG
    160164  totalAlloc += dwBytes;
    161 
     165#endif
     166 
    162167  //align at 8 byte boundary
    163168  lpHeapObj = (HEAPELEM *)(((ULONG)lpMem+7) & ~7);
     
    251256  int size = Size(0, lpMem);
    252257  dprintf(("OS2Heap::Free lpMem = %X, size %d\n", lpMem, size));
     258#ifdef DEBUG
    253259  totalAlloc -= size;
     260#endif
    254261#endif
    255262
     
    272279  dprintf(("OS2Heap::Validate, %X %X", dwFlags, lpMem));
    273280
    274   if(lpMem == NULL) {
    275         dprintf(("OS2Heap::Validate lpMem == NULL\n"));
    276         return(FALSE);
    277   }
    278281  /* verify lpMem address */
    279282  if (lpMem >= (LPVOID)ulMaxAddr || lpMem < (LPVOID)0x10000)
     
    341344OS2Heap *OS2Heap::heap = NULL;
    342345
     346
    343347//******************************************************************************
    344348//******************************************************************************
     
    353357  //NOTE: MUST use 64kb here or else we are at risk of running out of virtual
    354358  //      memory space. (when allocating 4kb we actually get 4kb + 60k uncommited)
    355   *size = (*size / 65536) * 65536 + 65536;
     359  *size = ( (*size / 65536) + 1) * 65536;
    356360
    357361  rc = DosAllocMem(&newblock, *size, PAG_READ|PAG_WRITE|PAG_COMMIT|PAG_EXECUTE);
Note: See TracChangeset for help on using the changeset viewer.