util::scoped_memory Class Reference

#include <mmap.hh>

List of all members.

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 ()


Detailed Description

Definition at line 59 of file mmap.hh.


Member Enumeration Documentation

Enumerator:
MMAP_ROUND_UP_ALLOCATED 
MMAP_ALLOCATED 
MALLOC_ALLOCATED 
NONE_ALLOCATED 

Definition at line 61 of file mmap.hh.


Constructor & Destructor Documentation

util::scoped_memory::scoped_memory ( void *  data,
std::size_t  size,
Alloc  source 
) [inline]

Definition at line 68 of file mmap.hh.

util::scoped_memory::scoped_memory (  )  [inline]

Definition at line 71 of file mmap.hh.

util::scoped_memory::scoped_memory ( std::size_t  to,
bool  zero_new 
)

Definition at line 59 of file mmap.cc.

References util::HugeMalloc().

Here is the call graph for this function:

util::scoped_memory::~scoped_memory (  )  [inline]

Definition at line 76 of file mmap.hh.

References reset().

Here is the call graph for this function:


Member Function Documentation

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().

Here is the caller graph for this function:

const char* util::scoped_memory::end (  )  const [inline]

Definition at line 80 of file mmap.hh.

void* util::scoped_memory::get (  )  const [inline]

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().

Here is the call graph for this function:

void util::scoped_memory::reset (  )  [inline]

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().

Here is the caller graph for this function:

Alloc util::scoped_memory::source (  )  const [inline]

Definition at line 83 of file mmap.hh.

Referenced by util::HugeRealloc().

Here is the caller graph for this function:

void* util::scoped_memory::steal (  )  [inline]

Definition at line 89 of file mmap.hh.

References NONE_ALLOCATED, and NULL.

Referenced by util::HugeRealloc().

Here is the caller graph for this function:


The documentation for this class was generated from the following files:

Generated on Thu Jul 6 00:34:50 2017 for Moses by  doxygen 1.5.9