Resetting the builder arena. May be a bug or two here still.

This commit is contained in:
Ben Vanik
2013-12-29 23:43:36 -08:00
parent 63f11732a5
commit cd9172ed62
5 changed files with 32 additions and 1 deletions

View File

@@ -35,6 +35,14 @@ void Arena::Reset() {
}
}
void Arena::DebugFill() {
auto chunk = head_chunk_;
while (chunk) {
memset(chunk->buffer, 0xCD, chunk->capacity);
chunk = chunk->next;
}
}
void* Arena::Alloc(size_t size) {
if (active_chunk_) {
if (active_chunk_->capacity - active_chunk_->offset < size) {