diff options
author | Kenneth Heafield <github@kheafield.com> | 2013-01-18 19:58:54 +0400 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2013-01-18 19:59:51 +0400 |
commit | fc5868d0fff647c3879668af4bfe6e1bab9e83ab (patch) | |
tree | d9b5026f32cc5ae603e6f42b1fc7128aeee4ba55 /util/pool.cc | |
parent | 5f7b91e702f809577d82a7570778d254d985ba93 (diff) |
KenLM df5be22 lmplz for estimation
Diffstat (limited to 'util/pool.cc')
-rw-r--r-- | util/pool.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/util/pool.cc b/util/pool.cc index 2dffd06f6..429ba1585 100644 --- a/util/pool.cc +++ b/util/pool.cc @@ -1,5 +1,7 @@ #include "util/pool.hh" +#include "util/scoped.hh" + #include <stdlib.h> namespace util { @@ -24,8 +26,7 @@ void Pool::FreeAll() { void *Pool::More(std::size_t size) { std::size_t amount = std::max(static_cast<size_t>(32) << free_list_.size(), size); - uint8_t *ret = static_cast<uint8_t*>(malloc(amount)); - if (!ret) throw std::bad_alloc(); + uint8_t *ret = static_cast<uint8_t*>(MallocOrThrow(amount)); free_list_.push_back(ret); current_ = ret + size; current_end_ = ret + amount; |