Cleaned up include guards
This commit is contained in:
parent
cdca49354a
commit
c9e2bc2278
7 changed files with 16 additions and 48 deletions
|
|
@ -1,9 +1,4 @@
|
|||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <cstring>
|
||||
#include <execinfo.h>
|
||||
#include <iostream>
|
||||
#include <setjmp.h>
|
||||
#include <stdexcept>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
|
|
@ -83,7 +78,8 @@ namespace GC
|
|||
{
|
||||
heap.collect();
|
||||
// If memory is not enough after collect, crash with OOM error
|
||||
throw std::runtime_error(std::string("Error: Heap out of memory"));
|
||||
if (heap.m_size + size > HEAP_SIZE)
|
||||
throw std::runtime_error(std::string("Error: Heap out of memory"));
|
||||
}
|
||||
|
||||
// If a chunk was recycled, return the old chunk address
|
||||
|
|
@ -159,25 +155,6 @@ namespace GC
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Advances an iterator and returns an element
|
||||
* at position `n`.
|
||||
*
|
||||
* @param list The list to retrieve an element from.
|
||||
*
|
||||
* @param n The position to retrieve an element at.
|
||||
*
|
||||
* @returns The pointer to the chunk at position n in list.
|
||||
*/
|
||||
// Chunk *Heap::get_at(std::vector<Chunk *> &list, size_t n)
|
||||
// {
|
||||
// auto iter = list.begin();
|
||||
// if (!n)
|
||||
// return *iter;
|
||||
// std::advance(iter, n);
|
||||
// return *iter;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns a bool whether the profiler is enabled
|
||||
* or not.
|
||||
|
|
@ -414,7 +391,13 @@ namespace GC
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void Heap::set_profiler(bool mode)
|
||||
{
|
||||
Heap &heap = Heap::the();
|
||||
heap.m_profiler_enable = mode;
|
||||
}
|
||||
|
||||
#ifdef HEAP_DEBUG
|
||||
/**
|
||||
* Prints the result of Heap::init() and a dummy value
|
||||
* for the current stack frame for reference.
|
||||
|
|
@ -565,12 +548,6 @@ namespace GC
|
|||
}
|
||||
}
|
||||
|
||||
void Heap::set_profiler(bool mode)
|
||||
{
|
||||
Heap &heap = Heap::the();
|
||||
heap.m_profiler_enable = mode;
|
||||
}
|
||||
|
||||
void Heap::print_allocated_chunks(Heap *heap) {
|
||||
cout << "--- Allocated Chunks ---\n" << endl;
|
||||
for (auto chunk : heap->m_allocated_chunks) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue