#include <mmap.hh>
Public Types | |
enum | Alloc { MMAP_ROUND_UP_ALLOCATED, MMAP_ALLOCATED, MALLOC_ALLOCATED, NONE_ALLOCATED } |
Public Member Functions | |
scoped_memory (void *data, std::size_t size, Alloc source) | |
scoped_memory () | |
scoped_memory (std::size_t to, bool zero_new) | |
~scoped_memory () | |
void * | get () const |
const char * | begin () const |
const char * | end () const |
std::size_t | size () const |
Alloc | source () const |
void | reset () |
void | reset (void *data, std::size_t size, Alloc from) |
void * | steal () |
Definition at line 59 of file mmap.hh.
util::scoped_memory::scoped_memory | ( | void * | data, | |
std::size_t | size, | |||
Alloc | source | |||
) | [inline] |
util::scoped_memory::scoped_memory | ( | std::size_t | to, | |
bool | zero_new | |||
) |
Definition at line 59 of file mmap.cc.
References util::HugeMalloc().
util::scoped_memory::~scoped_memory | ( | ) | [inline] |
const char* util::scoped_memory::begin | ( | ) | const [inline] |
Definition at line 79 of file mmap.hh.
Referenced by util::FilePiece::FilePiece(), and util::FilePiece::Offset().
void* util::scoped_memory::get | ( | ) | const [inline] |
Definition at line 78 of file mmap.hh.
Referenced by lm::ngram::trie::BuildTrie(), lm::ngram::SortedVocabulary::ComputeRenumbering(), util::Rolling::ExtractNonRolling(), lm::ngram::BinaryFormat::FinishFile(), lm::ngram::BinaryFormat::GrowForSearch(), util::HugeMalloc(), util::HugeRealloc(), lm::ngram::IsBinaryFormat(), lm::ngram::BinaryFormat::LoadBinary(), util::MapRead(), lm::ngram::BinaryFormat::SetupJustVocab(), lm::VocabReconstitute::VocabReconstitute(), and lm::ngram::BinaryFormat::WriteVocabWords().
void util::scoped_memory::reset | ( | void * | data, | |
std::size_t | size, | |||
Alloc | from | |||
) |
Definition at line 63 of file mmap.cc.
References MALLOC_ALLOCATED, MMAP_ALLOCATED, MMAP_ROUND_UP_ALLOCATED, NONE_ALLOCATED, and util::SizePage().
void util::scoped_memory::reset | ( | ) | [inline] |
Definition at line 85 of file mmap.hh.
References NONE_ALLOCATED, NULL, and reset().
Referenced by lm::ngram::SortedVocabulary::ComputeRenumbering(), util::Rolling::ExtractNonRolling(), lm::ngram::BinaryFormat::GrowForSearch(), util::HugeMalloc(), util::HugeRealloc(), util::MapRead(), reset(), lm::ngram::BinaryFormat::SetupJustVocab(), lm::ngram::BinaryFormat::WriteVocabWords(), and ~scoped_memory().
std::size_t util::scoped_memory::size | ( | ) | const [inline] |
Definition at line 81 of file mmap.hh.
Referenced by lm::ngram::BinaryFormat::FinishFile(), and util::HugeRealloc().
Alloc util::scoped_memory::source | ( | ) | const [inline] |
Definition at line 83 of file mmap.hh.
Referenced by util::HugeRealloc().
void* util::scoped_memory::steal | ( | ) | [inline] |
Definition at line 89 of file mmap.hh.
References NONE_ALLOCATED, and NULL.
Referenced by util::HugeRealloc().