/*
- * Copyright 2013 Facebook, Inc.
+ * Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
class Arena {
public:
explicit Arena(const Alloc& alloc,
- size_t minBlockSize = kDefaultMinBlockSize)
+ size_t minBlockSize = kDefaultMinBlockSize,
+ size_t sizeLimit = 0)
: allocAndSize_(alloc, minBlockSize)
, ptr_(nullptr)
, end_(nullptr)
, totalAllocatedSize_(0)
- , bytesUsed_(0) {
+ , bytesUsed_(0)
+ , sizeLimit_(sizeLimit) {
}
~Arena();
char* end_;
size_t totalAllocatedSize_;
size_t bytesUsed_;
+ size_t sizeLimit_;
};
/**
*/
class SysArena : public Arena<SysAlloc> {
public:
- explicit SysArena(size_t minBlockSize = kDefaultMinBlockSize)
- : Arena<SysAlloc>(SysAlloc(), minBlockSize) {
+ explicit SysArena(
+ size_t minBlockSize = kDefaultMinBlockSize,
+ size_t sizeLimit = 0)
+ : Arena<SysAlloc>(SysAlloc(), minBlockSize, sizeLimit) {
}
};