示例#1
0
void Game::nextHole()
{
	if(curHole+1 < course->holes->size())
	{
		curHole++;
		initHole(curHole);
	}
}
示例#2
0
// initialize the FreeNode header on all freelist entries.
void MemoryManager::initFree() {
  initHole();
  for (auto i = 0; i < kNumSmallSizes; i++) {
    for (auto n = m_freelists[i].head; n; n = n->next) {
      n->hdr.init(HeaderKind::Free, smallIndex2Size(i));
    }
  }
  m_needInitFree = false;
}
示例#3
0
/*
 * Get a new slab, then allocate nbytes from it and install it in our
 * slab list.  Return the newly allocated nbytes-sized block.
 */
NEVER_INLINE void* MemoryManager::newSlab(size_t nbytes) {
  if (UNLIKELY(m_stats.usage > m_stats.maxBytes)) {
    refreshStats();
  }
  initHole(); // enable parsing the leftover space in the old slab
  if (debug) checkHeap();
  auto slab = m_heap.allocSlab(kSlabSize);
  assert((uintptr_t(slab.ptr) & kSmartSizeAlignMask) == 0);
  m_stats.borrow(slab.size);
  m_stats.alloc += slab.size;
  if (m_stats.alloc > m_stats.peakAlloc) {
    m_stats.peakAlloc = m_stats.alloc;
  }
  m_front = (void*)(uintptr_t(slab.ptr) + nbytes);
  m_limit = (void*)(uintptr_t(slab.ptr) + slab.size);
  FTRACE(3, "newSlab: adding slab at {} to limit {}\n", slab.ptr, m_limit);
  return slab.ptr;
}
示例#4
0
/*
 * Get a new slab, then allocate nbytes from it and install it in our
 * slab list.  Return the newly allocated nbytes-sized block.
 */
NEVER_INLINE void* MemoryManager::newSlab(size_t nbytes) {
  if (UNLIKELY(m_stats.usage > m_stats.maxBytes)) {
    refreshStats();
  }
  if (debug) checkHeap();
  void* slab = safe_malloc(kSlabSize);
  assert((uintptr_t(slab) & kSmartSizeAlignMask) == 0);
  JEMALLOC_STATS_ADJUST(&m_stats, kSlabSize);
  m_stats.alloc += kSlabSize;
  if (m_stats.alloc > m_stats.peakAlloc) {
    m_stats.peakAlloc = m_stats.alloc;
  }
  initHole(); // enable parsing the leftover space in the old slab
  m_slabs.push_back(slab);
  m_front = (void*)(uintptr_t(slab) + nbytes);
  m_limit = (void*)(uintptr_t(slab) + kSlabSize);
  FTRACE(3, "newSlab: adding slab at {} to limit {}\n", slab, m_limit);
  return slab;
}
示例#5
0
BigHeap::iterator MemoryManager::begin() {
  initHole();
  initFree();
  return m_heap.begin();
}
示例#6
0
void MemoryManager::initHole() {
  if ((char*)m_front < (char*)m_limit) {
    initHole(m_front, (char*)m_limit - (char*)m_front);
  }
}
示例#7
0
MemoryManager::HeapIter MemoryManager::begin() {
  initHole();
  return HeapIter{0};
}